keepalive_timeout not working?

Maxim Dounin mdounin at
Thu Aug 22 18:34:33 UTC 2013


On Thu, Aug 22, 2013 at 01:03:01PM -0500, Sajan Parikh wrote:

> keepalives seem to be working, but the timeout limit I'm setting
> isn't honored it seems..  Someone let me know if I've done something
> wrong or am missing something.


> Yet, when I take a look at netstat -tc, I have waay too many http
> connections in a TIME_WAIT state and they seemingly stay there
> forever. Obviously it's not forever, but it's not closing in 3
> seconds.

TIME_WAIT is a TCP state, and any socket is expected to be in 
this state on a side which does an active close for 2 * MSL 
seconds after a connection is closed.

Reducing keepalive_timeout isn't expected to reduce number of 
sockets in a TIME_WAIT state.  On the contrary, it may cause more 
connections to be established and then closed, resulting in more 
sockets in TIME_WAIT state.

Maxim Dounin

More information about the nginx mailing list