Message ID | 1301077899-16482-1-git-send-email-hagen@jauu.net |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
From: Hagen Paul Pfeifer <hagen@jauu.net> Date: Fri, 25 Mar 2011 19:31:38 +0100 > sysctl_max_syn_backlog on the other hand provides similar functionality: > provides a system wide upper limit of request sockets per listen socket. > But sysctl_max_syn_backlog provides a more accurate value by considerate > the actual memory situation of the system. 256 by default, 128 for > systems with low memory and up to 1024 for larger systems. sysctl_max_syn_backlog is not "256 by default", the calculation is: cnt = tcp_hashinfo.ehash_mask + 1; ... sysctl_max_syn_backlog = max(128, cnt / 256); And I think we should leave the SOMAXCONN define alone (it's a historic relic for userspace, and any sane server passes something like ~0 into listen()). And calculate the somaxconn sysctl at run time using a similar formula to that used by sysctl_max_syn_backlog. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/include/linux/socket.h b/include/linux/socket.h index edbb1d0..bf35ce2 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -237,7 +237,7 @@ struct ucred { #define PF_MAX AF_MAX /* Maximum queue length specifiable by listen. */ -#define SOMAXCONN 128 +#define SOMAXCONN 256 /* Flags we can use with send/ and recv. Added those for 1003.1g not all are supported yet
sysctl_somaxconn specifies the maximum number of sockets in state SYN_RECV per listen socket and is initialized with 128 (SOMAXCONN). sysctl_max_syn_backlog on the other hand provides similar functionality: provides a system wide upper limit of request sockets per listen socket. But sysctl_max_syn_backlog provides a more accurate value by considerate the actual memory situation of the system. 256 by default, 128 for systems with low memory and up to 1024 for larger systems. This patch increase sysctl_somaxconn to 256 and provide environments with a increased RTT and many connections/second a better default value by simultaneously provides the fallback that smaller systems will not suffer of an increased memory usage - sysctl_max_syn_backlog is already a good guard. Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net> Cc: Eric Dumazet <eric.dumazet@gmail.com> --- include/linux/socket.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)