Varnish with many TIME_WAIT sockets and traffic problems

Marinos Yannikos mjy at
Mon Sep 26 15:33:57 CEST 2011

On 26.09.2011 15:21, John S. wrote:
> software configuration than our Squids. When we put it in our pool of
> servers, it gets half traffic than our Squids, and we have a lot of
> sockets stuck in TIME_WAIT state, with few established connexions, cf
> output of netstat on the varnish host :
>        6 CLOSING
>      259 ESTABLISHED
>       32 FIN_WAIT1
>      755 FIN_WAIT2
>       20 LAST_ACK
>       33 SYN_RECV
>     2781 TIME_WAIT

TIME_WAIT looks OK to me, it's not high. Here are some hints for sysctl 
settings: (do 
NOT set tw_recycle=1 though!).

Regarding half the traffic, just check whether you have failed requests 
(e.g. "varnishncsa -m TxStatus:[45]" or similar), but it can be due to 
the way Varnish handles keepalives differently (what are your Varnish 
vs. Squid settings for Keepalives?).


More information about the varnish-misc mailing list