question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

worker threads creating per connection not considering input 500

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:35 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
hyperxprocommented, Jul 13, 2020

Check my profile.

1reaction
hyperxprocommented, Jul 13, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found