diff options
author | Eric Dumazet <edumazet@google.com> | 2019-10-30 13:05:46 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-10-31 17:02:01 -0400 |
commit | 623d0c2db02043e43b698fdd8de1bd398b8e7b37 (patch) | |
tree | 53142e1249ec020cf559130f197077fd53c51139 | |
parent | 19f92a030ca6d772ab44b22ee6a01378a8cb32d4 (diff) |
tcp: increase tcp_max_syn_backlog max value
tcp_max_syn_backlog default value depends on memory size
and TCP ehash size. Before this patch, the max value
was 2048 [1], which is considered too small nowadays.
Increase it to 4096 to match the recent SOMAXCONN change.
[1] This is with TCP ehash size being capped to 524288 buckets.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willy Tarreau <w@1wt.eu>
Cc: Yue Cao <ycao009@ucr.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | Documentation/networking/ip-sysctl.txt | 7 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index 0e6653471c0e..8d4ad1d1ae26 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
@@ -408,11 +408,14 @@ tcp_max_orphans - INTEGER | |||
408 | up to ~64K of unswappable memory. | 408 | up to ~64K of unswappable memory. |
409 | 409 | ||
410 | tcp_max_syn_backlog - INTEGER | 410 | tcp_max_syn_backlog - INTEGER |
411 | Maximal number of remembered connection requests, which have not | 411 | Maximal number of remembered connection requests (SYN_RECV), |
412 | received an acknowledgment from connecting client. | 412 | which have not received an acknowledgment from connecting client. |
413 | This is a per-listener limit. | ||
413 | The minimal value is 128 for low memory machines, and it will | 414 | The minimal value is 128 for low memory machines, and it will |
414 | increase in proportion to the memory of machine. | 415 | increase in proportion to the memory of machine. |
415 | If server suffers from overload, try increasing this number. | 416 | If server suffers from overload, try increasing this number. |
417 | Remember to also check /proc/sys/net/core/somaxconn | ||
418 | A SYN_RECV request socket consumes about 304 bytes of memory. | ||
416 | 419 | ||
417 | tcp_max_tw_buckets - INTEGER | 420 | tcp_max_tw_buckets - INTEGER |
418 | Maximal number of timewait sockets held by system simultaneously. | 421 | Maximal number of timewait sockets held by system simultaneously. |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 6be568334848..b74192695955 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -2681,7 +2681,7 @@ static int __net_init tcp_sk_init(struct net *net) | |||
2681 | net->ipv4.tcp_death_row.sysctl_max_tw_buckets = cnt / 2; | 2681 | net->ipv4.tcp_death_row.sysctl_max_tw_buckets = cnt / 2; |
2682 | net->ipv4.tcp_death_row.hashinfo = &tcp_hashinfo; | 2682 | net->ipv4.tcp_death_row.hashinfo = &tcp_hashinfo; |
2683 | 2683 | ||
2684 | net->ipv4.sysctl_max_syn_backlog = max(128, cnt / 256); | 2684 | net->ipv4.sysctl_max_syn_backlog = max(128, cnt / 128); |
2685 | net->ipv4.sysctl_tcp_sack = 1; | 2685 | net->ipv4.sysctl_tcp_sack = 1; |
2686 | net->ipv4.sysctl_tcp_window_scaling = 1; | 2686 | net->ipv4.sysctl_tcp_window_scaling = 1; |
2687 | net->ipv4.sysctl_tcp_timestamps = 1; | 2687 | net->ipv4.sysctl_tcp_timestamps = 1; |