lots of connections on TIME_WAIT state

Artis Caune artis.caune at gmail.com
Wed Apr 8 11:47:16 MSD 2009

2009/4/7 Deepan Chakravarthy <codeshepherd at gmail.com>:
> Hi,
>   I am using nginx with fast-cgi .  When I run
> $netstat -np | grep
> I find lot of connections in TIME_WAIT state. Is this because of high
> keepalive_timeout value ?   When lot of people use (5 requests per second)
>  nginx takes more  time to respond. System load goes more than 10 during
> peak hours.

This is because of how TCP works.

> debian:~# netstat -np | grep
> tcp        0      0
> tcp        0      0

If you were on FreeBSD, you could disable TIME_WAIT on loopback
completely by setting:

    sysctl net.inet.tcp.nolocaltimewait=1

Maybe debian has similar /proc tuning or you can try to decrease msl
(maximum segment lifetime) or beter don't use inet sockets on loopback
- use unix sockets.

Artis Caune

<----. CCNA | BSDA
<----' didii FreeBSD

More information about the nginx mailing list