mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-09-02 18:20:33 +00:00
perf[net]: 优化boss group线程池数量
This commit is contained in:
@@ -68,9 +68,10 @@ public abstract class AbstractServer implements IServer {
|
||||
|
||||
protected synchronized void doStart(ChannelInitializer<? extends Channel> channelChannelInitializer) {
|
||||
var cpuNum = Runtime.getRuntime().availableProcessors();
|
||||
// 一条线程持有一个端口对应的selector,如果我们启动不仅仅是一个服务器端口的话,为了更好的性能需要修改对应的bossGroup数量
|
||||
bossGroup = Epoll.isAvailable()
|
||||
? new EpollEventLoopGroup(Math.max(1, cpuNum / 4), new DefaultThreadFactory("netty-boss", true))
|
||||
: new NioEventLoopGroup(Math.max(1, cpuNum / 4), new DefaultThreadFactory("netty-boss", true));
|
||||
? new EpollEventLoopGroup(Math.max(1, cpuNum / 8), new DefaultThreadFactory("netty-boss", true))
|
||||
: new NioEventLoopGroup(Math.max(1, cpuNum / 8), new DefaultThreadFactory("netty-boss", true));
|
||||
|
||||
workerGroup = Epoll.isAvailable()
|
||||
? new EpollEventLoopGroup(cpuNum * 2, new DefaultThreadFactory("netty-worker", true))
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "cppProtocol//ByteBuffer.h"
|
||||
#include "cppProtocol/ByteBuffer.h"
|
||||
|
||||
namespace byte_buffer_test {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user