[Twisted-Python] Speed of twisted on Amazon EC2

Tom van Neerijnen twisted at tomvn.com
Wed Apr 24 05:59:39 EDT 2013

Hi Tobias

Some comments inline but first an update on the next load test slightly
closer to my ultimate use case, which showed PyPy smoking the competition.

My test is now a request to a URL scheme like this:
/version/{app}/platform/{platform}. This gets translated into a get on
Redis for {app}-{platform} and the value is returned to the client.
All tests were on Ubuntu 12.10 on an m1.small instance on AWS with the load
test machine being an m1.large. The load test ran for about 10 minutes for
each framework.
Using Cyclone 1.1 on Twisted 13 on PyPy 2.0beta2 I was averaging about 1.8k
Using node-restify 2.4.1 and node-redis 0.8.3 node 0.10.4 I was doing about
1.2 r/s.
Go and Scala on Play were comparable to node.

This very simple load test has me very impressed with PyPys performance and
I look forward to load testing our full app when it's ready.

Thanks for the comments, they've been very helpful.

On Mon, Apr 22, 2013 at 8:12 AM, Tobias Oberstein <
tobias.oberstein at tavendo.de> wrote:

> 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.
PyPy 2.0beta2 had comparable 95 percentile latency to all the other
frameworks in my limited test so maybe that's the improvements you
mentioned? Or maybe my naive load tests, but I like to think it's the

> 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 ..
> I don't know much about the workings of the various GCs but my feeling is
I wasn't really stressing the GC with my limited test as there weren't very
many data structures in play.
That said over 10 minute load tests I didn't notice any blips in r/s or
response times so for my limited test it was all good.

> Tobias
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20130424/1f455730/attachment.htm 

More information about the Twisted-Python mailing list