Theoretical connections/second limit using Varnish

Michael S. Fischer michael at dynamine.net
Wed Apr 29 18:36:00 CEST 2009


On Apr 29, 2009, at 9:30 AM, Nick Loman wrote:

> Michael S. Fischer wrote:
>> On Apr 29, 2009, at 9:22 AM, Poul-Henning Kamp wrote:
>>> In message <49F87DE4.3040300 at loman.net>, Nick Loman writes:
>>>
>>>> Has Varnish got a solution to this problem which does not involve
>>>> time-wait recycling? One thing I've thought of is perhaps  
>>>> SO_REUSEADDR
>>>> is used or could be used when Varnish makes connections to the  
>>>> backend?
>>>
>>> Varnish tries as hard as reasonable to reuse backend connections,
>>> so you should be able to get multiple requests per backend  
>>> connection.
>>>
>>> If this is not the case for you, you should find out why backend  
>>> connections
>>> are not reused.
>
> Hi Poul-Henning, Michael,
>
> I've configured Apache with KeepAlive off, so I expect the TCP  
> connection to be closed after each request and Varnish won't be able  
> to use it.
>
> 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.

> 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.

--Michael



More information about the varnish-misc mailing list