TogetherOS / cicada

🚀 Fast lightweight HTTP service framework.
https://crossoverjie.top/categories/cicada/
Apache License 2.0
953 stars 212 forks source link

Boss线程数好像设置有误 #9

Closed cjqCN closed 6 years ago

cjqCN commented 6 years ago

Boss线程数好像设置有误 private static final int BOSS_SIZE = Runtime.getRuntime().availableProcessors() * 2; private static EventLoopGroup boss = new NioEventLoopGroup(BOSS_SIZE);

Netty 的服务器端的 acceptor 阶段, 没有使用到多线程, 服务器端的 ServerSocketChannel 只绑定到了 bossGroup 中的一个线程, 在调用 Java NIO 的 Selector.select 处理客户端的连接请求时, 实际上是在一个线程中的, 所以对只有一个服务的应用来说, bossGroup 设置多个线程是没有什么作用的

crossoverJie commented 6 years ago

@cjqCN

You are right and have been fixed.

10