netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] socket: increase default maximum listen queue length
@ 2011-03-20  1:50 Hagen Paul Pfeifer
  2011-03-20  4:41 ` David Miller
  2011-03-20  8:30 ` Eric Dumazet
  0 siblings, 2 replies; 16+ messages in thread
From: Hagen Paul Pfeifer @ 2011-03-20  1:50 UTC (permalink / raw)
  To: netdev; +Cc: Hagen Paul Pfeifer, Eric Dumazet

sysctl_somaxconn (SOMAXCONN: 128) specifies the maximum number of
sockets in state SYN_RECV per listen socket queue. At listen(2) time the
backlog is adjusted to this limit if bigger then that.

Afterwards in reqsk_queue_alloc() the backlog value is checked again
(nr_table_entries == backlog):

    nr_table_entries = min_t(u32, nr_table_entries, sysctl_max_syn_backlog);
    nr_table_entries = max_t(u32, nr_table_entries, 8);
    nr_table_entries = roundup_pow_of_two(nr_table_entries + 1);

sysctl_max_syn_backlog on the other hand is dynamically adjusted,
depending on the memory characteristic of the system. Default is 256,
128 for small systems and up to 1024 for bigger systems.

For real server work the defacto sysctl_somaxconn limit seems inadequate:

    Experiments with real servers show, that it is absolutely not enough
    even at 100conn/sec. 256 cures most of problems.

Increase default sysctl_somaxconn from 128 to 256 to meet todays condition by
simultaneously limit nr_table_entries by sysctl_max_syn_backlog which is
based on memory condition (max(128, (tcp_hashinfo.ehash_mask + 1 / 256)).

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(-)

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
-- 
1.7.4.1.57.g0466.dirty


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

end of thread, other threads:[~2011-03-21  7:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-20  1:50 [PATCH] socket: increase default maximum listen queue length Hagen Paul Pfeifer
2011-03-20  4:41 ` David Miller
2011-03-20 11:59   ` Hagen Paul Pfeifer
2011-03-20  8:30 ` Eric Dumazet
2011-03-20  9:04   ` Rémi Denis-Courmont
2011-03-20  9:36     ` Eric Dumazet
2011-03-20 11:39   ` Hagen Paul Pfeifer
2011-03-20 11:55     ` Eric Dumazet
2011-03-20 12:14       ` Hagen Paul Pfeifer
2011-03-20 23:04         ` [PATCH 1/2] " Hagen Paul Pfeifer
2011-03-20 23:04           ` [PATCH 2/2] socket: add minimum listen queue length sysctl Hagen Paul Pfeifer
2011-03-21  7:36             ` Eric Dumazet
2011-03-20 23:09           ` [PATCH 1/2] socket: increase default maximum listen queue length David Miller
2011-03-20 23:52             ` Hagen Paul Pfeifer
2011-03-21  0:18               ` David Miller
2011-03-20 23:57             ` 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;
as well as URLs for NNTP newsgroup(s).