Netdev List
 help / color / mirror / Atom feed
* SOMAXCONN = 128, but max defaults to 2048
@ 2011-10-08 11:51 Olaf van der Spek
  2011-10-08 12:35 ` Eric Dumazet
  0 siblings, 1 reply; 4+ messages in thread
From: Olaf van der Spek @ 2011-10-08 11:51 UTC (permalink / raw)
  To: netdev

Hi,

SOMAXCONN is defined as 128, but the max
("/proc/sys/net/ipv4/tcp_max_syn_backlog") appears to be 2048 by
default.
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?

Greetings,

Olaf

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: SOMAXCONN = 128, but max defaults to 2048
  2011-10-08 11:51 SOMAXCONN = 128, but max defaults to 2048 Olaf van der Spek
@ 2011-10-08 12:35 ` Eric Dumazet
  2011-10-08 12:44   ` Olaf van der Spek
  2011-10-10 21:14   ` Hagen Paul Pfeifer
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Dumazet @ 2011-10-08 12:35 UTC (permalink / raw)
  To: Olaf van der Spek; +Cc: netdev

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: SOMAXCONN = 128, but max defaults to 2048
  2011-10-08 12:35 ` Eric Dumazet
@ 2011-10-08 12:44   ` Olaf van der Spek
  2011-10-10 21:14   ` Hagen Paul Pfeifer
  1 sibling, 0 replies; 4+ messages in thread
From: Olaf van der Spek @ 2011-10-08 12:44 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev

On Sat, Oct 8, 2011 at 2:35 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le samedi 08 octobre 2011 à 13:51 +0200, Olaf van der Spek a écrit :
>> 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 ?

No, I mean basically removing the compile-time value and only using
the run-time value (from the kernel).

> accept()/listen() is not bound to TCP only.

What else is that value used for?

> 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

Isn't it a single-line change?

Olaf

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: SOMAXCONN = 128, but max defaults to 2048
  2011-10-08 12:35 ` Eric Dumazet
  2011-10-08 12:44   ` Olaf van der Spek
@ 2011-10-10 21:14   ` Hagen Paul Pfeifer
  1 sibling, 0 replies; 4+ messages in thread
From: Hagen Paul Pfeifer @ 2011-10-10 21:14 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Olaf van der Spek, netdev

* Eric Dumazet | 2011-10-08 14:35:38 [+0200]:

>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

Eric, I thought this change found no great acceptance ... ;-(

Hagen

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-10 21:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-08 11:51 SOMAXCONN = 128, but max defaults to 2048 Olaf van der Spek
2011-10-08 12:35 ` Eric Dumazet
2011-10-08 12:44   ` Olaf van der Spek
2011-10-10 21:14   ` Hagen Paul Pfeifer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox