diff mbox series

[v2] nfsd: allow more than 64 backlogged connections

Message ID 20240308180223.2965601-1-trond.myklebust@hammerspace.com (mailing list archive)
State New
Headers show
Series [v2] nfsd: allow more than 64 backlogged connections | expand

Commit Message

Trond Myklebust March 8, 2024, 6:02 p.m. UTC
From: Trond Myklebust <trond.myklebust@hammerspace.com>

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.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
v2: Use SOMAXCONN instead of a value of -1.

 utils/nfsd/nfssvc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jeffrey Layton March 8, 2024, 6:48 p.m. UTC | #1
On Fri, 2024-03-08 at 13:02 -0500, trondmy@gmail.com wrote:
> From: Trond Myklebust <trond.myklebust@hammerspace.com>
> 
> 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.
> 
> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> ---
> v2: Use SOMAXCONN instead of a value of -1.
> 
>  utils/nfsd/nfssvc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
> index 46452d972407..9650cecee986 100644
> --- a/utils/nfsd/nfssvc.c
> +++ b/utils/nfsd/nfssvc.c
> @@ -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;

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Chuck Lever March 8, 2024, 6:56 p.m. UTC | #2
On Fri, Mar 08, 2024 at 01:02:23PM -0500, trondmy@gmail.com 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.
> 
> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> ---
> v2: Use SOMAXCONN instead of a value of -1.
> 
>  utils/nfsd/nfssvc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
> index 46452d972407..9650cecee986 100644
> --- a/utils/nfsd/nfssvc.c
> +++ b/utils/nfsd/nfssvc.c
> @@ -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;
> -- 
> 2.44.0

Acked-by: Chuck Lever <chuck.lever@oracle.com>
Cedric Blancher March 11, 2024, 7:55 a.m. UTC | #3
Could you please ACK this for 6.6-LTS too ?

Ced

On Fri, 8 Mar 2024 at 19:58, Chuck Lever <chuck.lever@oracle.com> wrote:
>
> On Fri, Mar 08, 2024 at 01:02:23PM -0500, trondmy@gmail.com 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.
> >
> > Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> > ---
> > v2: Use SOMAXCONN instead of a value of -1.
> >
> >  utils/nfsd/nfssvc.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
> > index 46452d972407..9650cecee986 100644
> > --- a/utils/nfsd/nfssvc.c
> > +++ b/utils/nfsd/nfssvc.c
> > @@ -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;
> > --
> > 2.44.0
>
> Acked-by: Chuck Lever <chuck.lever@oracle.com>
>
> --
> Chuck Lever
>
Trond Myklebust April 11, 2024, 7:11 p.m. UTC | #4
On Fri, 2024-03-08 at 13:02 -0500, trondmy@gmail.com wrote:
> From: Trond Myklebust <trond.myklebust@hammerspace.com>
> 
> 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.
> 
> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> ---
> v2: Use SOMAXCONN instead of a value of -1.
> 
>  utils/nfsd/nfssvc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
> index 46452d972407..9650cecee986 100644
> --- a/utils/nfsd/nfssvc.c
> +++ b/utils/nfsd/nfssvc.c
> @@ -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;

Ping on the above.
Chen Hanxiao April 12, 2024, 1:56 a.m. UTC | #5
> -----邮件原件-----
> 发件人: Trond Myklebust <trondmy@hammerspace.com>
> 发送时间: 2024年4月12日 3:12
> 收件人: SteveD@redhat.com
> 抄送: linux-nfs@vger.kernel.org
> 主题: Re: [PATCH v2] nfsd: allow more than 64 backlogged connections
> 
> On Fri, 2024-03-08 at 13:02 -0500, trondmy@gmail.com wrote:
> > From: Trond Myklebust <trond.myklebust@hammerspace.com>
> >
> > 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.
> >

Tested-by: Chen Hanxiao <chenhx.fnst@fujitsu.com>

Regards,
- Chen
diff mbox series

Patch

diff --git a/utils/nfsd/nfssvc.c b/utils/nfsd/nfssvc.c
index 46452d972407..9650cecee986 100644
--- a/utils/nfsd/nfssvc.c
+++ b/utils/nfsd/nfssvc.c
@@ -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;