From: Eric Dumazet <eric.dumazet@gmail.com>
To: Olaf van der Spek <ml@vdspek.org>
Cc: netdev@vger.kernel.org
Subject: Re: SOMAXCONN = 128, but max defaults to 2048
Date: Sat, 08 Oct 2011 14:35:38 +0200 [thread overview]
Message-ID: <1318077339.5276.17.camel@edumazet-laptop> (raw)
In-Reply-To: <CAGVGHmt1OVOj0NSEo3qHCh1CR10eZTNjxuUh_mB6sXxcx5gKmA@mail.gmail.com>
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.
next prev parent reply other threads:[~2011-10-08 12:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-08 11:51 SOMAXCONN = 128, but max defaults to 2048 Olaf van der Spek
2011-10-08 12:35 ` Eric Dumazet [this message]
2011-10-08 12:44 ` Olaf van der Spek
2011-10-10 21:14 ` Hagen Paul Pfeifer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318077339.5276.17.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=ml@vdspek.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox