Theoretical connections/second limit using Varnish

Nick Loman nick at loman.net
Wed Apr 29 18:18:44 CEST 2009


Hi there,

Has anyone come to a satisfactory solution to the issue of running out 
of local port numbers when Varnish makes a connection to the backend server?

Under Linux, my understanding is the number of available port numbers 
can be increased to a maximum of 64511 by setting 
/proc/sys/net/ipv4/ip_local_port_range to 1024 - 65535.

Assuming sockets are left in TIME_WAIT for 60 seconds that would limit 
the number of backend connections Varnish can make to 64511/minute or 
1075/second.

It seems to be acceptable to reduce TIME_WAIT to perhaps 30 seconds, 
doubling that to 2150/second.

A solution often proposed is to use time wait recycling, or tw_reuse, 
but my understanding is that under Linux these settings are global and 
therefore can break NAT for user connections (all connections are 
conntracked and DNATted on our setup).

2150 requests/second is not an impossible number to achieve, especially 
with backend KeepAlive off.

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?

Regards,

Nick.



More information about the varnish-misc mailing list