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.

How to tune Netty to reduce writeAndFlush time

See original GitHub issue

Expected behavior

We are developing a Netty based HTTP2 server to replace exiting Java socket based server. We expect Netty + HTTP2 can give us better performance/latency.

Actual behavior

However, in a recent performance test, where multiple clients send large amount of GET requests to server, Netty+HTTP/2 behaved worse than socket implementation.

We tried one request per http/2 connection and http2 multiplexing. Both were worse than socket implementation. We also tried 1MB for GET and 4MB for GET, both were worse than socket implementation.

During the performance test, data is in memory and none of CPU/NIC saturated. (NIC/CPU usage lower than socket implementation. )

Our metrics showed that the majority of the time is in writeAndFlush: from writeAndFlush to listener invoked.

Is there any parameter we can tune to get better latency? (We have increased TCP buffer to 4MB)

Steps to reproduce

Minimal yet complete reproducer code (or URL to code)

Netty version

JVM version (e.g. java -version)

java -version java version “1.8.0_121” Java™ SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot™ 64-Bit Server VM (build 25.121-b13, mixed mode)

OS version (e.g. uname -a)

Linux

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
xiaoxipandacommented, Dec 4, 2020

You can reference cassandra optimization FlushConsolidationHandler implement.

Message#Dispatcher

2reactions
normanmaurercommented, Aug 21, 2020

Its really impossible to give any guidance without more details and profiling data. All we can do at the moment is basically guess

Read more comments on GitHub >

github_iconTop Results From Across the Web

Netty application optimization - Stack Overflow
Back to your original question (how to optimize Netty), there's two kind of things you could do: Micro-optimize allocations: using pooled ...
Read more >
Principles to Handle Thousands of Connections in Java Using ...
Principle 3: Stop Generating Garbage. If you really want to write an application that is going to be under the big load then...
Read more >
User guide for 4.x - Netty.docs
In this section, we discuss how to make sure the server works correctly and learn how to write a client with Netty.
Read more >
How Is Netty Used to Write a High-Performance Distributed ...
The only difference is the limit on the maximum number of file descriptors is lifted. Both select and poll are in LT mode....
Read more >
Netty Best Practices - YouTube
Red Hat's Norman Maurer brings you some Netty best practices and performance tips, specifically addressing HTTP/pipelining, ...
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