[Twisted-Python] Speed of twisted on Amazon EC2

Tobias Oberstein tobias.oberstein at tavendo.de
Mon Apr 22 03:12:55 EDT 2013


Tom,

>>which OS are you running on your EC2 instance? Amazon Linux?
>I am running two m1.small Ubuntu 12.10 64bit in us-east-1, one for the web server and the other for the ab.
>>Which reactor are you running your Twisted test with? Epoll?
>Default Linux reactor, so it's Epoll.

ok, thats good. just wanted to make sure you are aware of this and make sure epoll is actually used.

>>Are you running on CPython or PyPy?
>I am running on CPython with twisted 13.0.0 installed into a virtualenv, but please see my results for PyPy below, they're far more impressive.

thats also good (and I was somehow expecting this .. at least thats also my experience).

there is 1 thing to note when benchmarking networking stuff on PyPy vs CPython that I noticed in my testing:

both the throughput (bits/s or reqs/s) as well as the average (arithmetic mean) response times are far better with PyPy vs CPy

BUT (my testings - Twisted/Autobahn/WebSocket): e.g. the 95% quantile (and the worst case) response latency of PyPy is worse than CPy.

this was PyPy 1.6 on both Linux (epoll) and FreeBSD (kqueue).

the reason might be GC .. PyPy's GCs might be not as sophisticated as CPy's (likely) or V8's (definitely).

note: this might have changed with PyPy 2 (did not test that). Armin at least was planning for a generational/incremental GC in PyPy. dunno.

so: you might wanna test for latency also .. I'd be interested in results.

regarding GC, V8 and Erlang (and possibly that other VMs with the J at the beginning) have an edge ..

both LuaJIT and PyPy plan to improve on this though ..

Tobias



More information about the Twisted-Python mailing list