[Twisted-Python] Twisted reactor cpu usage

Itamar Turner-Trauring itamar at itamarst.org
Fri Mar 2 14:50:27 EST 2012

> I'm using epoll reactor and sample HTTP Proxy realization.
> From another process i'm executing ~30 HTTP requests per second and
> twisted process is consuming 10% cpu
> What is wrong? Why twisted perfomance is so poor here?

The profile output you included doesn't particularly show anything useful,

On my laptop ab claims twisted.web is doing 1000 requests/sec listing the
contents of a folder ("twistd -n web --path /tmp"). httperf claims 2500
request/sec. So unless your computer is dramatically slower than my
laptop, that does seem like high CPU usage.

1. What performance do you get out of twisted.web doing a simpler request?

2. What version of Twisted?

3. Was the 10% CPU while running under the profiler?

4. What profiler did you use? cProfile is often better than profile.

More information about the Twisted-Python mailing list