Hello! On Thu, Jul 21, 2016 at 07:02:48PM -0700, Aditya Umrani wrote:
> Hello, > > 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 > port. > ======== > 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? Yes. The so_keepalive parameter is configured on listening sockets and applies to connections accepted though these sockets. Using SO_KEEPALIVE on sockets to backends are not generally needed, as these connections are usually local and well-controlled. (And if it's not the case, many operation systems have an option to request TCP keepalive for all connection, like net.inet.tcp.always_keepalive on FreeBSD. Though looks like Linux isn't able to do so.) -- Maxim Dounin http://nginx.org/ _______________________________________________ nginx mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx
