[Twisted-Python] Performance and select.select

Itamar Shtull-Trauring itamar at itamarst.org
Thu Jan 3 20:18:51 MST 2008


> a) the select calls are really taking up that much time (more than 50%!)

They're certainly going to take up lots and lots of *clock* time, not
necessarily CPU time: select() is the way Twisted (in default reactors)
waits for events to happen. So if your program does nothing at all (e.g.
just reactor.run(), select() will actually be close to 100% of clock
time, even though CPU usage will be minuscule.

If you have many TCP connections (or really, file descriptors), hundreds
or thousands, select() will also start taking up CPU time. Using poll
reactor, or in next version of Twisted (2.5 had some bugs) epoll reactor
on Linux will use less CPU for this scenario.





More information about the Twisted-Python mailing list