[Twisted-Python] intermittent problem: not accepting new connections
Phil Mayers
p.mayers at imperial.ac.uk
Thu Sep 11 10:38:06 EDT 2008
Jean-Paul Calderone wrote:
> On Thu, 11 Sep 2008 14:31:38 +0100, "Paul C. Nendick"
> <paul.nendick at gmail.com> wrote:
>> Not necessarily related to what you've described, but I'll share
>> something that's helped a good deal on my most-heavily hit twisted
>> servers. Presuming you're using Linux:
>>
>> echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
>>
>>
>> from http://lartc.org/howto/lartc.kernel.obscure.html :
>>
>> "Enable fast recycling TIME-WAIT sockets. Default value is 1. It
>> should not be changed without advice/request of technical experts"
>>
>> My expert advice: only use this on machines connected on a low-latency
>> LAN. It *will* break internet-facing interfaces. It halves the
>> constant used by the Nagle algorithm:
>>
>> http://en.wikipedia.org/wiki/Nagle's_algorithm
>>
>
> This is somewhat interesting. It suggests a potential problem which
> I hadn't thought about before. If you need to accept more than about
> 64k connections (not necessarily concurrent) in less than TIME-WAIT
> seconds, you might run out of ports. Anyone know what happens to new
> connection attempts to a server in this condition?
Why would you run out of ports? accept()ed sockets use the same port as
the listen()ing socket.
Shortening TIME_WAIT just saves on kernel memory.
More information about the Twisted-Python
mailing list