On Sun, 15 May 2011 15:05:52 +0000, Or Gerson wrote:
Hello everyone, I have squid 3.0.STABLE19-1 installed. And 3 apache cache_peers. I find that squid is opening a lot of connections to the web servers a lot more than the connections he is receiving from clients, also squid doesn't close them and they are in TIME_WAIT status. For example: in squid I see 324 TIME_WAIT connections On each server I see around 800 TIME_WAIT connections
TIME_WAIT is a closing connection. ESTABLISHED is an open connection. This explains: http://www.developerweb.net/forum/showthread.php?t=2941
The cache_peers are configured with round-robin, but why squid doesn't closes the connections? Can't squid use one connection for each peer and send and receive all requests through that connection (although that probably will cause performance problems in the apache side because he won't uses all apache server processes)?
One connection to each is indeed a performance bottleneck. Pipelining is also not safe for HTTP/1.0 software (ie Squid 3.0 and older) without great risk of breakage (just ask Debian people about apt-get corruption problems). Squid uses as many connections to each peer as there are maximum parallel requests needing to go to that peer. Enable server_persistent_connections to servers and Squid will re-use connections as much as possible given the HTTP support version.
An upgrade to 3.1 series Squid will get you HTTP/1.1 connections to servers and peers. This gives a lot better re-use of the connections than HTTP/1.0 connection support in 3.0 series can. Provided Apache plays along and uses HTTP/1.1 features to prevent early TCP link closure.
Amos