New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cjqCN opened this Issue Sep 25, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@cjqCN
Member

cjqCN commented Sep 25, 2018

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

This comment has been minimized.

Show comment
Hide comment
@crossoverJie

crossoverJie Sep 25, 2018

Member

@cjqCN

You are right and have been fixed.

#10

Member

crossoverJie commented Sep 25, 2018

@cjqCN

You are right and have been fixed.

#10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment