All of lore.kernel.org
 help / color / mirror / Atom feed
* Default value of ipv4.tcp_keepalive_time
@ 2021-05-17  8:00 Troels Arvin
  2021-05-17 10:00 ` Willy Tarreau
  0 siblings, 1 reply; 2+ messages in thread
From: Troels Arvin @ 2021-05-17  8:00 UTC (permalink / raw)
  To: netdev

Hello,

At work, we have spent a great deal of work on a situation which ended 
up being resolved by changing the net.ipv4.tcp_keepalive_time sysctl to 
a value much lower than the default (we set it to 300). This was two 
Linux-based systems communicating without any firewalls in-between, 
where some long-running connections would be considered down by one 
system, while the other expected them to still be around.

The following is the description of the setting:
"The interval between the last data packet sent (simple ACKs are not 
considered data) and the first keepalive probe; after the connection is 
marked to need keepalive, this counter is not used any further."

The default value of net.ipv4.tcp_keepalive_time sysctl is 7200 seconds, 
i.e. two hours.

It seems odd to me to still have such a long period of waiting, before 
keep-alive kicks in. With such a long initial wait, it's questionable 
how much value the keep-alive functionality has, I think.

Could it be that it's time to change the default? I would suggest a 
value of 10 minutes, i.e. 600 seconds, but I have to admit, that I don't 
have any objective argument for exactly that value.

-- 
Regards,
Troels Arvin



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

* Re: Default value of ipv4.tcp_keepalive_time
  2021-05-17  8:00 Default value of ipv4.tcp_keepalive_time Troels Arvin
@ 2021-05-17 10:00 ` Willy Tarreau
  0 siblings, 0 replies; 2+ messages in thread
From: Willy Tarreau @ 2021-05-17 10:00 UTC (permalink / raw)
  To: Troels Arvin; +Cc: netdev

Hello,

On Mon, May 17, 2021 at 10:00:04AM +0200, Troels Arvin wrote:
> Hello,
> 
> At work, we have spent a great deal of work on a situation which ended up
> being resolved by changing the net.ipv4.tcp_keepalive_time sysctl to a value
> much lower than the default (we set it to 300). This was two Linux-based
> systems communicating without any firewalls in-between, where some
> long-running connections would be considered down by one system, while the
> other expected them to still be around.
> 
> The following is the description of the setting:
> "The interval between the last data packet sent (simple ACKs are not
> considered data) and the first keepalive probe; after the connection is
> marked to need keepalive, this counter is not used any further."
> 
> The default value of net.ipv4.tcp_keepalive_time sysctl is 7200 seconds,
> i.e. two hours.
> 
> It seems odd to me to still have such a long period of waiting, before
> keep-alive kicks in. With such a long initial wait, it's questionable how
> much value the keep-alive functionality has, I think.
> 
> Could it be that it's time to change the default? I would suggest a value of
> 10 minutes, i.e. 600 seconds, but I have to admit, that I don't have any
> objective argument for exactly that value.

There is no good value, it's entirely dependent on the application. At
least with a large default value you have little risk to flood your
links when dealing with hundreds of thousands to millions of idle
connections (think WebSocket for example). A 10 minute value would
still be too large for plenty of users but cause excessive traffic
for others.

I strongly suggest that the value must be tunable in the application
instead, that's the only way to get it right for everyone (see
TCP_KEEPCNT, TCP_KEEPINTVL and TCP_KEEPIDLE).

Just my two cents,
Willy

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

end of thread, other threads:[~2021-05-17 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-17  8:00 Default value of ipv4.tcp_keepalive_time Troels Arvin
2021-05-17 10:00 ` Willy Tarreau

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.