2024-03-08 18:09:15

by Trond Myklebust

[permalink] [raw]
Subject: [PATCH v2] 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.

Signed-off-by: Trond Myklebust <[email protected]>
---
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



2024-03-08 18:48:18

by Jeffrey Layton

[permalink] [raw]
Subject: Re: [PATCH v2] nfsd: allow more than 64 backlogged connections

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.
>
> Signed-off-by: Trond Myklebust <[email protected]>
> ---
> 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 <[email protected]>

2024-03-08 18:57:18

by Chuck Lever

[permalink] [raw]
Subject: Re: [PATCH v2] nfsd: allow more than 64 backlogged connections

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.
>
> Signed-off-by: Trond Myklebust <[email protected]>
> ---
> 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 <[email protected]>

--
Chuck Lever

2024-03-11 07:56:55

by Cedric Blancher

[permalink] [raw]
Subject: Re: [PATCH v2] nfsd: allow more than 64 backlogged connections

Could you please ACK this for 6.6-LTS too ?

Ced

On Fri, 8 Mar 2024 at 19:58, Chuck Lever <[email protected]> wrote:
>
> 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.
> >
> > Signed-off-by: Trond Myklebust <[email protected]>
> > ---
> > 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 <[email protected]>
>
> --
> Chuck Lever
>


--
Cedric Blancher <[email protected]>
[https://plus.google.com/u/0/+CedricBlancher/]
Institute Pasteur

2024-04-11 19:13:42

by Trond Myklebust

[permalink] [raw]
Subject: Re: [PATCH v2] nfsd: allow more than 64 backlogged connections

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.
>
> Signed-off-by: Trond Myklebust <[email protected]>
> ---
> 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.

--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]


2024-04-12 01:57:12

by Chen Hanxiao

[permalink] [raw]
Subject: Re: [PATCH v2] nfsd: allow more than 64 backlogged connections



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

Tested-by: Chen Hanxiao <[email protected]>

Regards,
- Chen