Theoretical connections/second limit using Varnish

Nick Loman nick at loman.net
Thu Apr 30 17:10:15 CEST 2009


Michael S. Fischer wrote:

>> I've done that for a specific reason relating to backend PHP processes.
> 
> I don't dispute your reasoning; my employer does this as well.  
> KeepAlive with Apache/PHP can be a recipe for resource starvation on 
> your origin servers.

Hi Michael,

Precisely, we only have perhaps 50 PHP children serving requests, so if 
these are kept open to serve idle keep-alive connections, that severely 
limits the numbers of dynamic page requests we can serve.

>> I typically have thousands of connections in TIME_WAIT mode as a 
>> result, which is expected, but I wonder what the solution could be if 
>> I ever hit more connections than local ports available.
> 
> I think SO_REUSEADDR is the answer - I'm somewhat surprised that Varnish 
> doesn't set it by default for the backend connections.

I've had a browse through the Varnish 2.0.4 source now and have 
convinced myself that SO_REUSEADDR isn't set. Can you think of any 
specific gotchas I might encounter if I added setsockopt() before the 
connect() when getting a backend connection?

Cheers,

Nick.



More information about the varnish-misc mailing list