优化netty设置

This commit is contained in:
Guoqs
2024-11-28 10:16:43 +08:00
parent 2ca952740c
commit a72036d55e

View File

@@ -58,6 +58,7 @@ public class NettyServerManager implements CommandLineRunner {
.childOption(ChannelOption.SO_SNDBUF, 64 * 1024) // 发送缓冲区
.childOption(ChannelOption.WRITE_BUFFER_WATER_MARK, new WriteBufferWaterMark(32 * 1024, 64 * 1024)) // 写缓冲水位
.childOption(ChannelOption.SO_REUSEADDR, true)
.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) // 启用池化内存分配器
.childHandler(nettyServerChannelInitializer)
.localAddress(new InetSocketAddress(host, port));