Add netty epoll

This commit is contained in:
Andrea Cavalli 2024-09-27 00:11:04 +02:00
parent df98b40884
commit 1621bb73ca

View File

@ -71,6 +71,10 @@ public class GrpcServer extends Server {
this.grpc = new GrpcServerImpl(this.getClient());
EventLoopGroup elg;
Class<? extends ServerChannel> channelType;
if (http2Port != 0) {
elg = new NioEventLoopGroup(Runtime.getRuntime().availableProcessors() * 2);
channelType = NioServerSocketChannel.class;
} else {
try {
elg = new EpollEventLoopGroup(Runtime.getRuntime().availableProcessors() * 2);
channelType = EpollServerDomainSocketChannel.class;
@ -79,6 +83,7 @@ public class GrpcServer extends Server {
elg = new NioEventLoopGroup(Runtime.getRuntime().availableProcessors() * 2);
channelType = NioServerSocketChannel.class;
}
}
this.elg = elg;
this.executor = Executors.newWorkStealingPool(Runtime.getRuntime().availableProcessors() * 2);
this.server = NettyServerBuilder.forAddress(new InetSocketAddress(http2Host, http2Port))