关闭内存泄露监测;提高业务线程池容量

This commit is contained in:
Guoqs
2025-11-03 16:29:32 +08:00
parent 545aaf5126
commit 3e39c8aa82
3 changed files with 118 additions and 59 deletions

View File

@@ -15,9 +15,6 @@ import io.netty.handler.codec.mqtt.MqttEncoder;
import io.netty.handler.logging.LogLevel;
import io.netty.handler.logging.LoggingHandler;
import io.netty.handler.timeout.IdleStateHandler;
import io.netty.util.ResourceLeakDetector;
import io.netty.util.concurrent.DefaultEventExecutorGroup;
import io.netty.util.concurrent.EventExecutorGroup;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
@@ -75,8 +72,8 @@ public class NettyServerManager implements CommandLineRunner {
ChannelFuture future = bootstrap.bind(port).sync();
// 在启动时启用内存泄漏检测
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID);
// 在启动时启用内存泄漏检测 2025年11月3日16点23分关闭内存泄露检测
// ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID);
if (future.isSuccess()) {
log.info("NettyServer启动成功, 开始监听端口:{}", port);

View File

@@ -23,7 +23,7 @@ public class NettyServerChannelInitializer extends ChannelInitializer<SocketChan
private EchoServerHandler echoServerHandler;
// 引入业务线程池
final EventExecutorGroup businessGroup = new DefaultEventExecutorGroup(16);
final EventExecutorGroup businessGroup = new DefaultEventExecutorGroup(32);
@Override
protected void initChannel(SocketChannel channel) throws Exception {