* [PATCH net] tcp: increase tcp_max_syn_backlog max value
@ 2019-10-30 17:05 Eric Dumazet
2019-10-31 21:02 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2019-10-30 17:05 UTC (permalink / raw)
To: David S . Miller
Cc: netdev, Eric Dumazet, Eric Dumazet, Neal Cardwell, Yuchung Cheng,
Willy Tarreau, Yue Cao
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>
---
Documentation/networking/ip-sysctl.txt | 7 +++++--
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 ffa5f8892a66ed3bfcd53903cc6badf28dfa0f50..6405f6fa756be0dac510281eff2f273b520eccea 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -408,11 +408,14 @@ tcp_max_orphans - INTEGER
up to ~64K of unswappable memory.
tcp_max_syn_backlog - INTEGER
- Maximal number of remembered connection requests, which have not
- received an acknowledgment from connecting client.
+ Maximal number of remembered connection requests (SYN_RECV),
+ which have not received an acknowledgment from connecting client.
+ This is a per-listener limit.
The minimal value is 128 for low memory machines, and it will
increase in proportion to the memory of machine.
If server suffers from overload, try increasing this number.
+ Remember to also check /proc/sys/net/core/somaxconn
+ A SYN_RECV request socket consumes about 304 bytes of memory.
tcp_max_tw_buckets - INTEGER
Maximal number of timewait sockets held by system simultaneously.
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index c616f0ad1fa0bcd07460142a4a86ad13d9177c84..1dd0fc12676f99508341c78d40b941abc8528072 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2679,7 +2679,7 @@ static int __net_init tcp_sk_init(struct net *net)
net->ipv4.tcp_death_row.sysctl_max_tw_buckets = cnt / 2;
net->ipv4.tcp_death_row.hashinfo = &tcp_hashinfo;
- net->ipv4.sysctl_max_syn_backlog = max(128, cnt / 256);
+ net->ipv4.sysctl_max_syn_backlog = max(128, cnt / 128);
net->ipv4.sysctl_tcp_sack = 1;
net->ipv4.sysctl_tcp_window_scaling = 1;
net->ipv4.sysctl_tcp_timestamps = 1;
--
2.24.0.rc0.303.g954a862665-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] tcp: increase tcp_max_syn_backlog max value
2019-10-30 17:05 [PATCH net] tcp: increase tcp_max_syn_backlog max value Eric Dumazet
@ 2019-10-31 21:02 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-10-31 21:02 UTC (permalink / raw)
To: edumazet; +Cc: netdev, eric.dumazet, ncardwell, ycheng, w, ycao009
From: Eric Dumazet <edumazet@google.com>
Date: Wed, 30 Oct 2019 10:05:46 -0700
> 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>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-31 21:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30 17:05 [PATCH net] tcp: increase tcp_max_syn_backlog max value Eric Dumazet
2019-10-31 21:02 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.