Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7012787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:18:04+00:00 2026-05-27T22:18:04+00:00

I have some questions about Netty (Server Side), TCP/IP applications; I am wondering if

  • 0

I have some questions about Netty (Server Side), TCP/IP applications;

I am wondering if there can be latency because of netty (due to missing configuration etc.) while passing the request from boss thread to worker thread ?

I am using :

new OrderedMemoryAwareThreadPoolExecutor(350, 0, 0, 1, TimeUnit.SECONDS);

Actually, I set max thread count 350 as I am not sure about the optimal number. I log simultaneous working thread count every minute and it seems that average is too low (barely exceeds 10). So I will decrease this number as it is not required.

Is there any other parameters,important points that I should be aware of for to get best performance ?

bootstrap.setOption("tcpNoDelay", true); – Is there any disadvantage of setting this parameter? Considering that delivery time is very important.

Thread Pool Executer:

OrderedMemoryAwareThreadPoolExecutor executor = new OrderedMemoryAwareThreadPoolExecutor(48, 0, 0, 1, TimeUnit.SECONDS);

Here is my pipeline factory:

    ChannelPipeline pipeline = pipeline();
    pipeline.addLast("frameDecoder", new DelimiterBasedFrameDecoder(GProperties.getIntProperty("decoder.maxFrameLength", 8000 * 1024), Delimiters.nulDelimiter()));
    pipeline.addLast("stringDecoder", new StringDecoder( CharsetUtil.UTF_8 ));      
    pipeline.addLast("frameEncoder", new NullTermMessageEncoder());
    pipeline.addLast("stringEncoder", new JSONEncoder( CharsetUtil.UTF_8 ));
        pipeline.addLast("timeout", new IdleStateHandler(idleTimer, 42 , 0, 0));
    pipeline.addLast("executor", new ExecutionHandler(executor));
    pipeline.addLast("handler", new GServerHandler());

and the ServerBootstrap:

gServerBootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));
        gServerBootstrap.setPipelineFactory(new GServerPipelineFactory());
                gServerBootstrap.setOption("backlog", 8129);
                gServerBootstrap.setOption("child.tcpNoDelay", true);
        gServerBootstrap.bind(new InetSocketAddress(GProperties.getIntProperty("server.port", 7679)));

What can you suggest for this configuration ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:18:05+00:00Added an answer on May 27, 2026 at 10:18 pm

    Netty Boss threads are only used to setup connection, worker threads are used to run NioWorker (non blocking read/write) or OioWorker (blocking read/write).

    If you have an execution handler, worker thread will submit the message event to OrderedMemoryAwareThreadPoolExecutor.

    1) Increasing the Netty I/O worker thread count to more than number of processors * 2 won’t help. If you are using staged executors, Having more than one staged execution handler for non I/O tasks, may increase latency.

    Note: Its better to set your own ObjectSizeEstimator implementation in OMTPE
    constructor, because many CPU cycles are spent on calculating used channel memory.

    2) There are some other Netty parameters you can try

       //setting buffer size can improve I/O
       bootstrap.setOption("child.sendBufferSize", 1048576);
       bootstrap.setOption("child.receiveBufferSize", 1048576); 
    
       // better to have an receive buffer predictor 
       bootstrap.setOption("receiveBufferSizePredictorFactory", new AdaptiveReceiveBufferSizePredictorFactory(MIN_PACKET_SIZE, INITIAL_PACKET_SIZE, MAX_PACKET_SIZE))  
    
       //if the server is sending 1000 messages per sec, optimum write buffer water marks will
       //prevent unnecessary throttling, Check NioSocketChannelConfig doc   
       bootstrap.setOption("writeBufferLowWaterMark", 32 * 1024);
       bootstrap.setOption("writeBufferHighWaterMark", 64 * 1024);
    

    3) It should be bootstrap.setOption(“child.tcpNoDelay”, true) for server bootstrap.

    There is an experimental hidden parameter:

    Netty NioWorker is using SelectorUtil.select to wait for selector events, the wait time is hard coded in SelectorUtil,

    selector.select(500);
    

    setting a small value gave better performance in netty sctp transport implementation. Not sure about TCP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some questions about apns in my own server-side application. I have a
I have some questions about importing data from Excel/CSV File into SQL Server. Let
i have some questions about Maven 2 and i hope somebody can clear things
I have some questions about building reports in Report builder 3.0 OR SQL Server
I have some questions about treeview in WPF. How can I change header of
I have some questions about Qt creator. Under Win XP, I can use autocomplete
I have some questions about java. There are two questions in the code (I
I have some questions about vector ; How can I append one vector in
I have some questions about multi-threaded programming and multi-core usage. In particular I'm wondering
i have some questions about constructors in ColdFusion : must i use the name

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.