[Twisted-Python] What's twistd doing on Windows?

Bob Ippolito bob at redivi.com
Thu Apr 3 16:31:32 MST 2003


On Thursday, Apr 3, 2003, at 18:16 America/New_York, Christopher 
Armstrong wrote:

> On Thu, Apr 03, 2003 at 05:16:02PM -0500, Alan McIntyre wrote:
>> I did notice something that I'm curious about: I've been running two
>> Twisted web instances, one on a Win2k machine (1.4GHz P4, Python 
>> 2.2.2)
>> and one on a Debian machine (266MHz PII, Python 2.1.3) for a few days
>> now, and the Windows instance has accumulated almost an hour of CPU 
>> time
>> wherease the Debian instance has only used 2 seconds.  What's the 
>> Win32
>> instance doing while it's idle? (It's not a big deal, I'm just 
>> curious)
>
> My first guess would be that the system calls involved (e.g., select)
> are more expensive than on linux, but that's just a wild guess. I
> doubt profiling would be much help, but maybe you (or someone) could
> write a simple test that just recorded the time it takes to run an
> immediately-returning select() a few thousand times.

IIRC, the Twisted select reactor has a "background process" that gets 
triggered once a second or so when running on windows just to break the 
select() call (I don't believe it actually does anything).  I believe 
this is because processes in windows don't respond to signals (like 
ctrl-c, for example) during a select() call, so this 
convenience/workaround was put into the codebase.

In any case, an hour of CPU time over a few days is pretty negligible, 
but worthy of note for comparison's sake I suppose.. On a more heavily 
used Twisted daemon, it really wouldn't make any difference, since the 
select() call would spend less time idling.

-bob





More information about the Twisted-Python mailing list