Search squid archive

Re: Linux: Cannot bind to socket ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



mån 2007-03-26 klockan 11:08 -0400 skrev NGUYEN, KHANH, ATTSI:

> I send a load of 4000-5000 request/second to the server. After about 5
> hours, the ability to serve 5000 requests drops and the cache.log is
> filled with error 'commBind: Cannot bind socket FD 204 to *:0: (98)
> Address already in use

You ran out of free ports, all ports occupied by open server connections
of TIME_WAIT sockets.

TCP is much better at accepting connections than making connections at
high rates. Making outgoing connections requires a free port, and the
port gets occupied for the lifetime of the connection + TIME_WAIT (2
minutes).

The port range used by the kernel is specified
in /proc/sys/net/ipv4/ip_local_port_range, and you You can safely use
1024 65535 which gives you 64.5K available ports which should be able to
sustain a constant load of 5K connections/s.

To go above that you need to either improve how the kernel assigns ports
to outgoing connections allowing it to make use of multiple IP
addresses, or modify Squid to "manually" assign the local ip:port
manually when making outgoing connections.

Another thing which significantly improves the situation is to make sure
you have support for persistent connections enabled in your backend
servers (and Squid). This significantly reduces the amount of
connections made by reusing server connections for multiple requests.

Regards
Henrik

Attachment: signature.asc
Description: Detta =?ISO-8859-1?Q?=E4r?= en digitalt signerad meddelandedel


[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux