netty 按需声明,去掉用不到的模块

netty-all 是聚合 pom,会拖进 35 个模块:osx/aarch64/riscv64 的 epoll 与 kqueue
native、codec-http3/mqtt/redis/smtp/stomp/xml/protobuf、transport-rxtx/sctp/udt
等,而节点只用 ServerBootstrap/Bootstrap/NioEventLoopGroup/NioServerSocketChannel/
NioSocketChannel/ByteBuf/ByteToMessageCodec/LengthFieldBasedFrameDecoder。

收敛为 transport + codec(buffer/common/resolver 传递引入)。节点侧未使用
handler 模块的类,故不声明。4.1 无独立 codec-base,编解码基类在 netty-codec。

效果:lib 16MB -> 13MB,netty 模块 35 -> 5,进程 RSS 171MB -> 约 155-162MB。
15 个测试全绿,重启后与主站长连接正常重建(主站日志确认「存储节点上线」)。
hutool 未动。
This commit is contained in:
root
2026-09-21 17:27:22 +08:00
parent c76af43b7c
commit 6a97e403ba
+19 -1
View File
@@ -16,7 +16,25 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>io.netty</groupId> <groupId>io.netty</groupId>
<artifactId>netty-all</artifactId> <!--
只保留实际用到的模块。原先的 netty-all 是聚合 pom,会拖进 35 个模块
(含 osx/aarch64/riscv64 的 epoll/kqueue native、codec-http3/mqtt/redis/
smtp/stomp/xml/protobuf、transport-rxtx/sctp/udt 等),
而本节点只用 ServerBootstrap/Bootstrap/NioEventLoopGroup/
NioServerSocketChannel/NioSocketChannel/ByteBuf/ByteToMessageCodec/
LengthFieldBasedFrameDecoder。
transport 提供 Bootstrap/EventLoop/Channel,codec 提供
ByteToMessageCodec 与 LengthFieldBasedFrameDecoder。
buffer/common/resolver 由它们传递引入。这里不用 handler:
节点侧未使用 LoggingHandler 等 handler 模块的类。
-->
<artifactId>netty-transport</artifactId>
<version>4.1.138.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
<version>4.1.138.Final</version> <version>4.1.138.Final</version>
</dependency> </dependency>