[Twisted-Python] profiling twisted

Jean-Paul Calderone exarkun at divmod.com
Mon Jul 2 07:14:48 EDT 2007


On Mon, 02 Jul 2007 11:04:56 +0200, Markus Schiltknecht <markus at bluegap.ch> wrote:
> [snip]
>Anyway, with very simple timing measures within the twisted server itself, 
>I've figured out what was causing the delays: reactor.spawnProcess() takes 
>more than a second.  I knew that fork() was expensive, but that expensive?

This isn't normal.

>
>What I'm doing now feels very dirty: I'm calling reactor.spawnProcess() from 
>a thread. (Yes, I'm taking care that only one thread can spawn a process at 
>any time.) At least on my Linux Dev-Box, that seems to work - and resolves 
>my issue. But... calling fork() from a thread???
>

Er.  That's not supported.  The only Twisted API you can call from a thread
is reactor.callFromThread.

Jean-Paul




More information about the Twisted-Python mailing list