You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by "wenjianhn (via GitHub)" <gi...@apache.org> on 2026/09/23 12:17:32 UTC
[PR] Increase the default backlog of listen() to net.core.somaxconn of Linux. [zookeeper]
wenjianhn opened a new pull request, #2461:
URL: https://github.com/apache/zookeeper/pull/2461
Another approach to fix ZOOKEEPER-974. Our use case is to handle 100k clients.
50 is a very small value. Google has been using 1024 for at least 21 years, and they increased this to 4096 after TCP listener rework has been completed, more than 11 years ago. They got no complain of this change breaking any legacy application. See
https://github.com/torvalds/linux/commit/19f92a030ca6d772ab44b22ee6a01378a8cb32d4
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Increase the default backlog of listen() to net.core.somaxconn of Linux. [zookeeper]
Posted by "ikxeno (via GitHub)" <gi...@apache.org>.
ikxeno commented on code in PR #2461:
URL: https://github.com/apache/zookeeper/pull/2461#discussion_r4264191940
##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/NIOServerCnxnFactory.java:
##########
Review Comment:
I checked this in Docker on Ubuntu 24.04 (JDK 17/25) and Alpine 3.24 (JDK 25). All 17 selected tests passed in each container. I also checked the bind call on macOS/JDK 25.
The NIO backlog drops from 4096 to 50 after a client port change because reconfigure() still calls bind(addr). Could we pass the same backlog here? The change below kept both the default and an explicit value of 128.
```suggestion
ss.socket().bind(addr, listenBacklog == -1 ? Integer.MAX_VALUE : listenBacklog);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Increase the default backlog of listen() to net.core.somaxconn of Linux. [zookeeper]
Posted by "ikxeno (via GitHub)" <gi...@apache.org>.
ikxeno commented on code in PR #2461:
URL: https://github.com/apache/zookeeper/pull/2461#discussion_r4264088049
##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/NIOServerCnxnFactory.java:
##########
@@ -659,7 +659,7 @@ public void configure(InetSocketAddress addr, int maxcc, int backlog, boolean se
ss.socket().setReuseAddress(true);
LOG.info("binding to port {}", addr);
if (listenBacklog == -1) {
- ss.socket().bind(addr);
+ ss.socket().bind(addr, Integer.MAX_VALUE);
Review Comment:
I checked this in Docker on Ubuntu 24.04 (JDK 17/25) and Alpine 3.24 (JDK 25). All 17 selected tests passed in each container. I also checked the bind call on macOS/JDK 25.
The NIO backlog drops from 4096 to 50 after a client port change because reconfigure() still calls bind(addr). Could we pass the same backlog here? The change below kept both the default and an explicit value of 128.
```suggestion
ss.socket().bind(addr, listenBacklog == -1 ? Integer.MAX_VALUE : listenBacklog);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Increase the default backlog of listen() to net.core.somaxconn of Linux. [zookeeper]
Posted by "ikxeno (via GitHub)" <gi...@apache.org>.
ikxeno commented on code in PR #2461:
URL: https://github.com/apache/zookeeper/pull/2461#discussion_r4264088049
##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/NIOServerCnxnFactory.java:
##########
@@ -659,7 +659,7 @@ public void configure(InetSocketAddress addr, int maxcc, int backlog, boolean se
ss.socket().setReuseAddress(true);
LOG.info("binding to port {}", addr);
if (listenBacklog == -1) {
- ss.socket().bind(addr);
+ ss.socket().bind(addr, Integer.MAX_VALUE);
Review Comment:
I checked this in Docker on Ubuntu 24.04 (JDK 17/25) and Alpine 3.24 (JDK 25). All 17 selected tests passed in each container. I also checked the bind call on macOS/JDK 25.
The NIO backlog drops from 4096 to 50 after a client port change because reconfigure() still calls bind(addr). Could we pass the same backlog here? The change below kept both the default and an explicit value of 128.
```suggestion
ss.socket().bind(addr, listenBacklog == -1 ? Integer.MAX_VALUE : listenBacklog);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@zookeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org