Very Large number of connections in TIME_WAIT state; Server is slow, ipconntrac

Posted by Sparsh Gupta on Server Fault See other posts from Server Fault or by Sparsh Gupta
Published on 2011-02-07T20:57:33Z Indexed on 2011/02/08 7:26 UTC
Read the original article Hit count: 321

Filed under:

I have a nginx server with load balancing and reverse proxy. Right now its behing another nginx but very soon I plan to make it front, where it will receive TCP connections from clients directly at a rate of 500req/second

I am having some big troubles with the server. I have pasted my configurations here and I am kinda sure that the problem is with ipconntrac and similar things which are alient to me

http://paste.org/pastebin/view/28543

root@load_balancer:/proc/sys/net/ipv4# netstat -an|awk '/tcp/ {print $6}'|sort|uniq -c
     67 CLOSING
    727 ESTABLISHED
    173 FIN_WAIT1
    183 FIN_WAIT2
     19 LAST_ACK
      5 LISTEN
    447 SYN_RECV
      1 SYN_SENT
  27970 TIME_WAIT

Its a ubuntu machine with mainly nginx (load balancer and reverse proxy) installed.

It surely isnt great. Can you help me understand whats going on and how can I fix it. This is my live server and I am sure its in a bad shape right now. Any document or commands to fix this, or settings I should make to make this better and reduce time wait and fin_wait1/2 better would be awesome.

© Server Fault or respective owner

Related posts about nginx