so_keepalive option for outbound sockets

Aditya Umrani adityaumrani at
Fri Jul 22 02:02:48 UTC 2016


I've configured the so_keepalive option for a server (this is also my
default server). I do have other server configs listening to the same
listen 9822 default_server so_keepalive=on;
listen 29822 ssl http2 default_server so_keepalive=on;

My sysctl settings are set to :
net.ipv4.tcp_keepalive_time = 120
net.ipv4.tcp_keepalive_probes = 10
net.ipv4.tcp_keepalive_intvl = 120

However, I see that no tcp keepalive packets are being sent on
outbound connections (from nginx to the upstream). I also checked the
output of 'netstat -an --timers' I see that no outbound sockets have
the 'keepalive' flag. All of them are 'off'. If it matters, the server
config which actually servers this request is not the default one, but
one of the other configs.
I took a quick look at the code and the 'SO_KEEPALIVE' options only
shows up on functions which deal with listening sockets. Does this
mean that nginx does not honor this option for outbound connections?


More information about the nginx mailing list