[Twisted-Python] 100% CPU on high opened descriptors

Reza Lotun rlotun at gmail.com
Sun May 8 14:27:37 MDT 2011


Hi Juan,

2011/5/8 Juan Antonio IbaƱez Santorum <juanito1982 at gmail.com>

> MUST I apply that change or may be I SHOULD do it? Why is it necessary?


Each network connection on your system is represented by a 'file
descriptor', in Unix terminology. By default, there is a limit on the number
of open file descriptors that can be opened at once, which is a little
different for every system (usually its 1024 or 4096), even though the
system is actually capable of opening more network connections.

This limit is set in two places - systemwide and per-user. To run a network
server you have to increase the limits both in the kernel and for the user
the network process is running as. The 'sysctl' steps I previously mentioned
increases the limits for the kernel, and the 'ulimit' steps for the user. In
the example I gave, this limit was increased to 999999 which is extremely
high, and should be suitable for almost all production server deployments.

sysctl limits can be set permanently by editing /etc/sysctl.conf with new
kernel settings and then running 'sysctl -p'. ulimits can be changed at
runtime - the 'nofile' setting can be set by 'ulimit -n', or permanently by
editing /etc/security/limits.conf and rebooting/opening a new login shell.

Hope that clears it up.

Reza
-- 
Reza Lotun
mobile: +44 (0)7521 310 763
email:  rlotun at gmail.com
work:   reza at tweetdeck.com
twitter: @rlotun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20110508/dab0b5b5/attachment.html>


More information about the Twisted-Python mailing list