Skip to contentSkip to conversation

nfsd: allow more than 64 backlogged connections

PATCH In review [email protected] 8 participants 9 messages Mar 8, 2024 – May 10, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nfsd: allow more than 64 backlogged connections

From: Trond Myklebust <[email protected]>

When creating a listener socket to be handed to /proc/fs/nfsd/portlist, we currently limit the number of backlogged connections to 64. Since that value was chosen in 2006, the scale at which data centres operate has changed significantly. Given a modern server with many thousands of clients, a limit of 64 connections can create bottlenecks, particularly at at boot time.
Let's use the POSIX-sanctioned maximum value of SOMAXCONN.

---
v2: Use SOMAXCONN instead of a value of -1.

 utils/nfsd/nfssvc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
utils/nfsd/nfssvc.c +2 -1
index 46452d972407..9650cecee986 100644
@@ -205,7 +205,8 @@ nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
 			rc = errno;
 			goto error;
 		}
-		if (addr->ai_protocol == IPPROTO_TCP && listen(sockfd, 64)) {
+		if (addr->ai_protocol == IPPROTO_TCP &&
+		    listen(sockfd, SOMAXCONN)) {
 			xlog(L_ERROR, "unable to create listening socket: "
 				"errno %d (%m)", errno);
 			rc = errno;
Signature · 1 line
2.44.0
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 22 lines · On Fri, 2024-03-08 at 13:02 -0500, [email protected] wrote:

From: Trond Myklebust <[email protected]>

When creating a listener socket to be handed to /proc/fs/nfsd/portlist, we currently limit the number of backlogged connections to 64. Since that value was chosen in 2006, the scale at which data centres operate has changed significantly. Given a modern server with many thousands of clients, a limit of 64 connections can create bottlenecks, particularly at at boot time.
Let's use the POSIX-sanctioned maximum value of SOMAXCONN.

---
v2: Use SOMAXCONN instead of a value of -1.

 utils/nfsd/nfssvc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
utils/nfsd/nfssvc.c +0 -0
index 46452d972407..9650cecee986 100644

utils/nfsd/nfssvc.c nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port) · line 212

Quoted 9 lines
utils/nfsd/nfssvc.c +2 -1
@@ -205,7 +205,8 @@ nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
 			rc = errno;
 			goto error;
 		}
-		if (addr->ai_protocol == IPPROTO_TCP && listen(sockfd, 64)) {
+		if (addr->ai_protocol == IPPROTO_TCP &&
+		    listen(sockfd, SOMAXCONN)) {
 			xlog(L_ERROR, "unable to create listening socket: "
 				"errno %d (%m)", errno);
 			rc = errno;
Acked-by on v2 1/1
#2 lore raw
In reply to [email protected]
Quoted 31 lines · On Fri, Mar 08, 2024 at 01:02:23PM -0500, [email protected] wrote:

When creating a listener socket to be handed to /proc/fs/nfsd/portlist, we currently limit the number of backlogged connections to 64. Since that value was chosen in 2006, the scale at which data centres operate has changed significantly. Given a modern server with many thousands of clients, a limit of 64 connections can create bottlenecks, particularly at at boot time.
Let's use the POSIX-sanctioned maximum value of SOMAXCONN.

---
v2: Use SOMAXCONN instead of a value of -1.

 utils/nfsd/nfssvc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
utils/nfsd/nfssvc.c +2 -1
index 46452d972407..9650cecee986 100644
@@ -205,7 +205,8 @@ nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
 			rc = errno;
 			goto error;
 		}
-		if (addr->ai_protocol == IPPROTO_TCP && listen(sockfd, 64)) {
+		if (addr->ai_protocol == IPPROTO_TCP &&
+		    listen(sockfd, SOMAXCONN)) {
 			xlog(L_ERROR, "unable to create listening socket: "
 				"errno %d (%m)", errno);
 			rc = errno;
Signature · 1 line
2.44.0
Signature · 1 line
Chuck Lever
#3 lore raw

Could you please ACK this for 6.6-LTS too ?

Ced

Quoted 39 lines · Chuck Lever
Quoted 30 lines · On Fri, Mar 08, 2024 at 01:02:23PM -0500, [email protected] wrote:

When creating a listener socket to be handed to /proc/fs/nfsd/portlist, we currently limit the number of backlogged connections to 64. Since that value was chosen in 2006, the scale at which data centres operate has changed significantly. Given a modern server with many thousands of clients, a limit of 64 connections can create bottlenecks, particularly at at boot time.
Let's use the POSIX-sanctioned maximum value of SOMAXCONN.

---
v2: Use SOMAXCONN instead of a value of -1.

 utils/nfsd/nfssvc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
utils/nfsd/nfssvc.c +2 -2
index 46452d972407..9650cecee986 100644
@@ -205,7 +205,8 @@ nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
                      rc = errno;
                      goto error;
              }
-             if (addr->ai_protocol == IPPROTO_TCP && listen(sockfd, 64)) {
+             if (addr->ai_protocol == IPPROTO_TCP &&
+                 listen(sockfd, SOMAXCONN)) {
                      xlog(L_ERROR, "unable to create listening socket: "
                              "errno %d (%m)", errno);
                      rc = errno;
--
Quoted 1 line

2.44.0

--
Chuck Lever

Signature · 3 lines
Cedric Blancher <[email protected]>
[https://plus.google.com/u/0/+CedricBlancher/]
Institute Pasteur
#4 lore raw
In reply to [email protected]
Quoted 34 lines · On Fri, 2024-03-08 at 13:02 -0500, [email protected] wrote:

From: Trond Myklebust <[email protected]>

When creating a listener socket to be handed to /proc/fs/nfsd/portlist,
we currently limit the number of backlogged connections to 64. Since that value was chosen in 2006, the scale at which data centres operate
has changed significantly. Given a modern server with many thousands of
clients, a limit of 64 connections can create bottlenecks, particularly
at at boot time.
Let's use the POSIX-sanctioned maximum value of SOMAXCONN.

---
v2: Use SOMAXCONN instead of a value of -1.

 utils/nfsd/nfssvc.c | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
utils/nfsd/nfssvc.c +2 -1
index 46452d972407..9650cecee986 100644
@@ -205,7 +205,8 @@ nfssvc_setfds(const struct addrinfo *hints, const
 char *node, const char *port)
  			rc = errno;
  			goto error;
  		}
-		if (addr->ai_protocol == IPPROTO_TCP &&
 listen(sockfd, 64)) {
+		if (addr->ai_protocol == IPPROTO_TCP &&
+		    listen(sockfd, SOMAXCONN)) {
Quoted 4 lines

  xlog(L_ERROR, "unable to create listening
socket: "
  "errno %d (%m)", errno); rc = errno;

Ping on the above.

Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]
#5 lore raw
Quoted 24 lines

-----邮件原件-----
发件人: Trond Myklebust <[email protected]>
发送时间: 2024年4月12日 3:12
收件人: [email protected]
抄送: [email protected]
主题: Re: [PATCH v2] nfsd: allow more than 64 backlogged connections

Quoted 14 lines · On Fri, 2024-03-08 at 13:02 -0500, [email protected] wrote:

From: Trond Myklebust <[email protected]>

When creating a listener socket to be handed to /proc/fs/nfsd/portlist,
we currently limit the number of backlogged connections to 64. Since that value was chosen in 2006, the scale at which data centres operate
has changed significantly. Given a modern server with many thousands of
clients, a limit of 64 connections can create bottlenecks, particularly
at at boot time.
Let's use the POSIX-sanctioned maximum value of SOMAXCONN.

Regards,
- Chen

Reviewed-by Jeffrey Layton on v2 1/1
#6 lore raw
In reply to [email protected]
Quoted 34 lines · On Fri, 2024-03-08 at 13:02 -0500, [email protected] wrote:

From: Trond Myklebust <[email protected]>

When creating a listener socket to be handed to /proc/fs/nfsd/portlist,
we currently limit the number of backlogged connections to 64. Since that value was chosen in 2006, the scale at which data centres operate
has changed significantly. Given a modern server with many thousands of
clients, a limit of 64 connections can create bottlenecks, particularly
at at boot time.
Let's use the POSIX-sanctioned maximum value of SOMAXCONN.

---
v2: Use SOMAXCONN instead of a value of -1.

 utils/nfsd/nfssvc.c | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
utils/nfsd/nfssvc.c +2 -1
index 46452d972407..9650cecee986 100644
@@ -205,7 +205,8 @@ nfssvc_setfds(const struct addrinfo *hints, const
 char *node, const char *port)
  			rc = errno;
  			goto error;
  		}
-		if (addr->ai_protocol == IPPROTO_TCP &&
 listen(sockfd, 64)) {
+		if (addr->ai_protocol == IPPROTO_TCP &&
+		    listen(sockfd, SOMAXCONN)) {
Quoted 4 lines

  xlog(L_ERROR, "unable to create listening
socket: "
  "errno %d (%m)", errno); rc = errno;

Steve,

Is there some reason you've not committed this patch? It seems fairly straightforward. I think I sent this earlier, but:

Signature · 1 line
Jeff Layton <[email protected]>
#7 lore raw
Quoted 42 lines · Jeff Layton
Quoted 35 lines · On Fri, 2024-03-08 at 13:02 -0500, [email protected] wrote:

From: Trond Myklebust <[email protected]>

When creating a listener socket to be handed to /proc/fs/nfsd/portlist,
we currently limit the number of backlogged connections to 64. Since that value was chosen in 2006, the scale at which data centres operate
has changed significantly. Given a modern server with many thousands of
clients, a limit of 64 connections can create bottlenecks, particularly
at at boot time.
Let's use the POSIX-sanctioned maximum value of SOMAXCONN.

---
v2: Use SOMAXCONN instead of a value of -1.

  utils/nfsd/nfssvc.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
utils/nfsd/nfssvc.c +2 -1
index 46452d972407..9650cecee986 100644
@@ -205,7 +205,8 @@ nfssvc_setfds(const struct addrinfo *hints, const
 char *node, const char *port)
  			rc = errno;
  			goto error;
  		}
-		if (addr->ai_protocol == IPPROTO_TCP &&
 listen(sockfd, 64)) {
+		if (addr->ai_protocol == IPPROTO_TCP &&
+		    listen(sockfd, SOMAXCONN)) {
  			xlog(L_ERROR, "unable to create listening
Quoted 3 lines

socket: "
  "errno %d (%m)", errno); rc = errno;

Steve,

Quoted 5 lines

Is there some reason you've not committed this patch? It seems fairly straightforward. I think I sent this earlier, but:

Thanks for the poke... The patch was not on my todo list.

I'm on it...

steved.

#8 lore raw
In reply to [email protected]
Quoted 11 lines · On 3/8/24 1:02 PM, [email protected] wrote:

From: Trond Myklebust <[email protected]>

When creating a listener socket to be handed to /proc/fs/nfsd/portlist, we currently limit the number of backlogged connections to 64. Since that value was chosen in 2006, the scale at which data centres operate has changed significantly. Given a modern server with many thousands of clients, a limit of 64 connections can create bottlenecks, particularly at at boot time.
Let's use the POSIX-sanctioned maximum value of SOMAXCONN.

Committed... Sorry it took so long... The patch was not on my radar... Feel free to ping when things linger this long.

steved.

Quoted 20 lines

---
v2: Use SOMAXCONN instead of a value of -1.

  utils/nfsd/nfssvc.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
utils/nfsd/nfssvc.c +2 -1
index 46452d972407..9650cecee986 100644
@@ -205,7 +205,8 @@ nfssvc_setfds(const struct addrinfo *hints, const char *node, const char *port)
  			rc = errno;
  			goto error;
  		}
-		if (addr->ai_protocol == IPPROTO_TCP && listen(sockfd, 64)) {
+		if (addr->ai_protocol == IPPROTO_TCP &&
+		    listen(sockfd, SOMAXCONN)) {
  			xlog(L_ERROR, "unable to create listening socket: "
  				"errno %d (%m)", errno);
  			rc = errno;