worker threads creating per connection not considering input 500
See original GitHub issueExpected 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
Issue Analytics
- State:
- Created 3 years ago
- Comments:35 (18 by maintainers)
Top Results From Across the Web
Configure the max worker threads Server Configuration Option
A worker thread is assigned only to active requests and is released once the request is serviced. This happens even if the user...
Read more >How to solve java.lang.OutOfMemoryError: unable to create ...
Firstly, check the number of Threads running in your application; Then, check system-wide Thread settings; Next, check the number of Processes ...
Read more >Requests take too much time in Tomcat 8 on peak time
If there are so many connections, shouldn't tomcat create more threads (up to 500) to respond faster? So, what am I doing wrong?...
Read more >Multithreading and Concurrency - Java Programming Tutorial
A multi-thread program has an initial entry point (the main() method), followed by many entry and exit points, which are run concurrently with...
Read more >ThreadPoolExecutor in Python: The Complete Guide
Each thread in the pool is called a worker or a worker thread. ... In general, we do not create Future objects; we...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.