netty: worker threads creating per connection not considering input 500
Expected behavior
create more worker threads and high performance
Actual behavior
created only 1 worker thread per connection giving low performance - most of txns timeout due to late response
Steps to reproduce
my application static connection (client-server) high volumes of transactions.
Minimal yet complete reproducer code (or URL to code)
private EventLoopGroup bossGroup = new EpollEventLoopGroup(4, Executors.newCachedThreadPool());
private EventLoopGroup workerGroup = new EpollEventLoopGroup(500, Executors.newCachedThreadPool());
// ===========================================================
// 1. define a separate thread pool to execute handlers with
// slow business logic. e.g database operation
// ===========================================================
group = new DefaultEventExecutorGroup(500); //thread pool of 500
try {
ServerBootstrap bootstrap = new ServerBootstrap();
bootstrap.group(bossGroup, workerGroup)
//Linux Native Library classes
.channel(EpollServerSocketChannel.class)
.childHandler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch)
throws Exception {
ch.pipeline().addLast("decoder", new Decoder())
.addLast("encoder", new Encoder())
.addLast(group, new Handler());
}
}).option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.option(ChannelOption.SO_BACKLOG, 128)
.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
.childOption(ChannelOption.SO_SNDBUF, 1024 * 1024)
.childOption(ChannelOption.SO_RCVBUF, 32 * 1024)
.childOption(ChannelOption.TCP_NODELAY, true)
.childOption(ChannelOption.SO_KEEPALIVE, true);
Netty version
4.1.50.Final
JVM version (e.g. java -version)
Open JdK11
OS version (e.g. uname -a)
linux
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 35 (18 by maintainers)
Check my profile.
Maybe I can help if you contact me via email because I don’t feel this is the right place to discuss about something which is not a Netty issue.
Try this: bossGroup = new EpollEventLoopGroup(4); workerGroup = new EpollEventLoopGroup(12);
Haha, looks cute.
Future#getis a blocking call so you’re blocking Netty there.Use this: