[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1318077339.5276.17.camel@edumazet-laptop>
Date: Sat, 08 Oct 2011 14:35:38 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Olaf van der Spek <ml@...pek.org>
Cc: netdev@...r.kernel.org
Subject: Re: SOMAXCONN = 128, but max defaults to 2048
Le samedi 08 octobre 2011 à 13:51 +0200, Olaf van der Spek a écrit :
> Hi,
>
> SOMAXCONN is defined as 128, but the max
> ("/proc/sys/net/ipv4/tcp_max_syn_backlog") appears to be 2048 by
> default.
It depends on memory size and TCP hash table size :
dmesg | grep "TCP established hash table entries"
-> TCP established hash table entries: 524288 (order: 11, 8388608 bytes)
sysctl_max_syn_backlog = max(128, cnt / 256);
cnt = 524288
cnt/256 -> 2048
> Is the name of SOMAXCONN wrong and is it actually defining the default?
> Would there be a disadvantage to defining SOMAXCONN as INT_MAX and
> letting the kernel control the actual max?
>
You mean : remove somaxconn tunable ?
accept()/listen() is not bound to TCP only.
But yes, 128 default is a bit old today, given that Apache uses a
listen(fd, 511) default value itself...
I routinely set net.core.somaxconn to 1024 on my servers.
We had a recent discussion on the matter lately, but Hagen Paul Pfeifer
did not polish his patches enough :
http://lists.openwall.net/netdev/2011/03/20/3
FreeBSD has a separate mechanism for not yet established sockets, called
syncache, that allows a low somaxconn per listener.
The socket queue holds only fully established (but not yet accept()ed)
sockets, while syncache holds all the SYN_RECV ones.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists