<div dir="ltr"><div class="gmail_extra"><div>Hi Tobias<br><br>My apologies, I should have included that information.<br>Before I get into my responses you&#39;ve alluded to the answer already,
 which is to say I should have been running on PyPy in the first place.<br>Twisted on PyPy is, at least for this really pointless benchmark, faster than node.<br><br></div>I&#39;ve re-run my tests using virtualenvs ( I was using Ubuntu packages which may have been behind the latest releases), taken more care to record the machine states, added PyPy to the mix and am responding inline with my answers.<br>
<br><div class="gmail_quote">On Sun, Apr 21, 2013 at 1:36 PM, Tobias Oberstein <span dir="ltr">&lt;<a href="mailto:tobias.oberstein@tavendo.de" target="_blank">tobias.oberstein@tavendo.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Tom,<br>
<br>
which OS are you running on your EC2 instance? Amazon Linux?<br></blockquote><div>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.<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<br>
Which reactor are you running your Twisted test with? Epoll?<br></blockquote><div>Default Linux reactor, so it&#39;s Epoll.<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<br>
Are you running on CPython or PyPy?<br></blockquote><div>I am running on CPython with twisted 13.0.0 installed into a virtualenv, but please see my results for PyPy below, they&#39;re far more impressive.<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<br>
Can we see you Twisted hello world test app?<br></blockquote><div>Sure:<br>from twisted.web import server, resource<br>from twisted.internet import reactor<br><br>class HelloResource(resource.Resource):<br>    isLeaf = True<br>
<br>    def render_GET(self, request):<br>        request.setHeader(&quot;content-type&quot;, &quot;text/plain&quot;)<br>        return &quot;Hello world!\n&quot;<br><br>reactor.listenTCP(8080, server.Site(HelloResource()))<br>
reactor.run()<br> <br><br></div><div>And for comparison the node code:<br>var http = require(&#39;http&#39;);<br>http.createServer(function (req, res) {<br>  res.writeHead(200, {&#39;Content-Type&#39;: &#39;text/plain&#39;});<br>
  res.end(&#39;Hello world!\n&#39;);<br>}).listen(8080, &#39;0.0.0.0&#39;);<br><br><br></div><div>As I said you&#39;ve already answered my question but here are my slightly more controlled benchmarks from an ab -c 10 -n 100000 (I ran three and used the average of the last two to ensure a warm JIT).<br>
<br></div><div>This time Twisted 13.0.0 in a CPython virtualenv yielded around 700 req/s.<br></div><div>Twisted 13.0.0 in a PyPy virtualenv yielded around 1.6k req/s.<br></div><div>Node 0.6.19 yielded around 1.6k req/s.<br>
<br></div><div>And for giggles 3x the concurrency with ab -c 30 -n 100000, which shows Twisted on PyPy pulling ahead:<br></div><div>Twisted 13.0.0 in a PyPy virtualenv yielded around 2k req/s.<br>Node 0.6.19 yielded around 1.6k req/s.<br>
<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Tobias<br>
<br>
<br>
Mit freundlichen Grüßen,<br>
<br>
Tobias Oberstein<br>
Geschäftsführer<br>
<br>
<a href="tel:%2B49%280%299131%20940%203574" value="+4991319403574">+49(0)9131 940 3574</a><br>
<a href="tel:%2B49%280%29176%2023%20752%20055" value="+4917623752055">+49(0)176 23 752 055</a><br>
<a href="mailto:tobias.oberstein@tavendo.de">tobias.oberstein@tavendo.de</a><br>
Skype: toberstein<br>
Twitter: @oberstet<br>
Xing: Tobias Oberstein<br>
<br>
<br>
<br>
Tavendo GmbH · Am Weihersbach 13 · 91074 Herzogenaurach · Deutschland<br>
Office / Postanschrift : Waldstrasse 18 · 91054 Erlangen · Deutschland<br>
+49(+)700 GO TAVENDO · +49(0)700 46 828 36 36 · <a href="http://www.tavendo.de" target="_blank">www.tavendo.de</a><br>
Amtsgericht Fürth · HRB 10365 · USt-Id.Nr DE246462916 · Geschäftsführer Tobias Oberstein<br>
<br>
Von: <a href="mailto:twisted-python-bounces@twistedmatrix.com">twisted-python-bounces@twistedmatrix.com</a> [mailto:<a href="mailto:twisted-python-bounces@twistedmatrix.com">twisted-python-bounces@twistedmatrix.com</a>] Im Auftrag von Tom van Neerijnen<br>

Gesendet: Sonntag, 21. April 2013 12:58<br>
An: <a href="mailto:twisted-python@twistedmatrix.com">twisted-python@twistedmatrix.com</a><br>
Betreff: [Twisted-Python] Speed of twisted on Amazon EC2<br>
<div><div class="h5"><br>
Hi all<br>
I recently wrote a hello world HTTP app in Twisted, Cyclone, node, Go and Scala on the Play framework, and used a combination of ab and gattling to see how fast each was on an m1.small instance on Amazon EC2. I also tested it on bare metal (my laptop:)) but I&#39;ll get to that later.<br>

The code I used for twisted was the web server code sample from the front page of <a href="http://twistedmatrix.com" target="_blank">twistedmatrix.com</a> with the numberRequests increment dropped and a simple &quot;Hello World!&quot; returned instead.<br>

For cyclone I used the sample code from the cyclone docs with the same string being returned.<br>
Node was the sample from their front page.<br>
Play and Go I&#39;ve never worked with before so those were copy pastes from various examples on their pages but again same URI and return string as the other frameworks.<br>
<br>