-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increase ServerConnector accept queue size #15596
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach LGTM although it would be nice to only log the warning on Linux.
return Integer.parseInt(in.readLine().trim()); | ||
} | ||
catch (Exception e) { | ||
log.warn("Unable to read /proc/sys/net/core/somaxconn, falling back to default value for TCP accept queue size"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be good to only log this warning on Linux. The file will never be there on macOS so the warning is always going to happen, which isn't ideal. Maybe use System.getProperty("os.name")
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Increase TCP accept queue size.
Description
The ServerConnector class defaults _acceptQueueSize to 0 which appears to result in a value of min(net.core.somaxconn, 50) on Jetty being passed to the listen() system call. This number can be too low especially when there are many brokers/coordinators trying to setup connections to a historical or real-time index process.
When this queue fills up there will be dropped packets and there can be downstream connection timeouts/connection resets depending on the underlying system settings (e.g. if syncookies are enabled).
Fixed the bug ...
Renamed the class ...
Added a forbidden-apis entry ...
I originally decided to make _acceptQueueSize a configurable property, but to avoid adding another configuration I decided to follow the logic I saw in dropwizard (a java web framework) when configuring jetty.(https://github.com/dropwizard/dropwizard/blob/7f6827d119639a57d2a696d371c3bbdb3007acb5/dropwizard-jetty/src/main/java/io/dropwizard/jetty/NetUtil.java#L37).
Essentially this checks the value of '/proc/sys/net/core/somaxconn' and sets _acceptQueueSize to that value, or the default linux value for somaxconn of 128 if the file is not readable.
Release note
Increase _acceptQueueSize based on value of net.core.somaxconn.
Key changed/added classes in this PR
JettyServerModule
This PR has: