update 电单车netty使用内存池

This commit is contained in:
Guoqs
2024-12-29 11:24:50 +08:00
parent 4e85f4cc05
commit 1780865f9f
2 changed files with 34 additions and 33 deletions

View File

@@ -96,6 +96,7 @@ public class NettyServerManager implements CommandLineRunner {
.handler(new LoggingHandler(LogLevel.DEBUG))
.option(ChannelOption.SO_BACKLOG, 128)
.option(ChannelOption.SO_REUSEADDR, true)
.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) // 启用池化内存分配器
.childOption(ChannelOption.SO_KEEPALIVE, true)
.childOption(ChannelOption.SO_REUSEADDR, true)
.childHandler(electricBicyclesServerChannelInitializer)