
Twisted.web vs Tornado, a Performance test - roder
http://www.apparatusproject.org/blog/2009/09/twisted-web-vs-tornado-performance-test/
======
coconutrandom
ironically an article about web server performance just got hosed by HN.

~~~
greut
Google Cache got it right before it melt down:
[http://74.125.77.132/search?q=cache%3Awww.apparatusproject.o...](http://74.125.77.132/search?q=cache%3Awww.apparatusproject.org%2Fblog%2F2009%2F09%2Ftwisted-
web-vs-tornado-performance-test%2F)

~~~
AndrewHampton
It's back up.

------
sophacles
So my first thought on this Tornado stuff was: why not glue twisted and
tornado together? A quick look at the code suggests it is doable, and could
help fix the "web mess" in twisted.

My second thought was: Why didn't they build this on libevent, and pyevent,
which has a built-in non-blocking webserver which is pretty darned fast.

~~~
PhilChristensen
what 'web mess in twisted' are you referring to?

~~~
illumen
There are two web implementations, and neither are complete(eg, twisted.web
does not support even http 1.1). Even the twisted developers will tell you
they are not happy with the web code in twisted. twisted.web2 was the future
and twisted.web was to be depreciated, now twisted.web is the future and
twisted.web2 is to be depreciated... the mess is still being cleaned up.

Link to the twisted web page describing the situation and the plan:
<http://twistedmatrix.com/trac/wiki/TwistedWebPlan>

~~~
PhilChristensen
that's just not true. i use web1 extensively, and it works very well, and
although it's performance is not as good as apache or lighttpd when serving
raw files, it's more than adequate for most web application development.

web2 was never a formally released product, and most of the stuff that was
only available in web2 (such as wsgi support) have now been backported. there
was some confusion about this for awhile, but that was only ever a community
issue, not a code-related one.

i primarily took issue with you calling it a "mess", i still think that's a
rather inaccurate statement.

~~~
sophacles
Specifically, from the outside looking in, exactly what you described is(was?)
a mess. Last I looked it was confusing as to what I should use, what would be
supported in the future, who (web or web2) had what feature, and what even
worked. That was quite a while a go (like over a year). More recently, talk at
pycon suggested things had not improved much, but I haven't verified that. I
am open to the possibility that things have improved since I last looked,
particularly given the overall quality of twisted stuff.

I still wonder tho, if this would be good to graft into twisted?

------
davidw
Would be interesting to see mochiweb and a few other things thrown in there
(maybe nginx for raw throughput).

~~~
siong1987
<http://siong1987.com/eventmachinethin-vs-twisted-vs-tornado>

------
anotherjesse
I think Tornado is awesome since the applications you write can be read by
_normal_ people.

While Twisted is powerful (and as the poster said, in the same magnitude of
performance), it has a tough learning curve.

Even if Tornado isn't successful, I think it just pushed the bar on how an
async web framework can be written. I look forward to seeing other frameworks
evolve as a response (I'm looking at you sinatra!).

~~~
dlsspy
I find twisted relatively easy to work with. There's no particular reason
tornado can't sit atop twisted. Hopefully I'll get some time to do that this
weekend.

The whole tornado vs. twisted thing is unfortunate, though. It exists in its
current state because tornado is two different things: 1) a web framework 2)
an async network stack.

#2 exists in core python and in twisted. If we transplant #1 to twisted, then
it should be just as easy to develop web apps on twisted, except you get a
_whole_ lot of stuff for free.

~~~
moe
_If we transplant #1 to twisted, then it should be just as easy to develop web
apps on twisted, except you get a whole lot of stuff for free._

That would be... beyond awesome.

~~~
dlsspy
FYI, I've pushed up some code. Unfortunately, tornado has no tests, so I'm
absolutely certain it's not completely functional, but it works as far as I'm
able to test a few things on localhost.

<http://github.com/dustin/tornado>

I'd love some help, of course. :)

~~~
moe
Glad you kicked this off.

I'm not deep enough in twisted myself to contribute but I see others have
already joined in - awesome!

~~~
dlsspy
You don't have to be deep into twisted. You can just try to make an app with
it, or run a demo or something and let me know what works/fails.

As Tornado has no unit tests, it's difficult to see what's right or wrong
without a human actually doing the work.

------
antonovka
The results are missing latency numbers for the concurrent requests, and
there's no indication of the amount of work being done to handle a request,
which will have a significant impact on load performance.

That said, performance testing Python web server implementations seems bit
like racing snails. If speed is why you're using Python, you're probably using
the wrong tool.

------
old-gregg
I wonder where standard Python's SimpleHttp server stands in there. I don't
code Python much, but to me it seems that all these guys sit on top of
Python's asyncore package, no?

~~~
simonw
Tornado has its own C wrapper around epoll (
[http://github.com/facebook/tornado/blob/9e24ae162d024e4049b8...](http://github.com/facebook/tornado/blob/9e24ae162d024e4049b8811d7ca19e319c20021d/tornado/epoll.c)
), but falls back to select() if the wrapper can't be compiled.

~~~
paul
It will also use Python 2.6's native epoll (see line 326 of
[http://github.com/facebook/tornado/blob/9a8bd2fb6fd6279be16d...](http://github.com/facebook/tornado/blob/9a8bd2fb6fd6279be16d6f0a2e57e49fe1b98f8f/tornado/ioloop.py))

~~~
old-gregg
Does this mean Python's own HTTPServer uses epoll starting v2.6?

~~~
paul
No, not that I'm aware of. It simply means that Python 2.6 makes the epoll
system call available directly without need for a custom module.

------
drawkbox
Both twisted and Tornado are very fun to work on and I think it is great they
are focused on performance. This is nothing but good for web frameworks in
Python.

------
coolmenu
I see He test Tornado in MacBookPro, i think mac os dont have epoll, and
tornado use select(). so i think he will test it in linux (2.6).

------
WilliamLP
The Deep Blue analogy is strained, now that Rybka 3 on a notebook computer
will easily trounce the best human player in the world.

------
KevBurnsJr
I've noticed some strange behavior with ab. Suggest testing with httperf as
well.

