[Chicago] Facebook open sources FriendFeed's real-time Python web framework, Tornado

Kumar McMillan kumar.mcmillan at gmail.com
Tue Sep 15 03:52:09 CEST 2009


On Mon, Sep 14, 2009 at 8:11 PM, Garrett Smith <g at rre.tt> wrote:
> I'm maintaining an informal list of benchmark results of a simple "Hello
> World" style app for various web servers. I just updated the list to include
> Tornado.
>
> These benchmarks are part of a web framework I'm working on in Erlang called
> Landshark. The app must print the test "You're that clever shark, aren't
> you" in either HTML or plain text. The numbers are from Apache Benchmark
> running for 10 seconds under different concurrency levels.
>
> The numbers below are not rigorous by any stretch. In fact, please consider
> them, officially, damned lies.
>
> Based on these lies, however, here's my personal takeaway, at least as far
> as the Python servers are concerned:
>
> CherryPy is very, very fast and has the upside of being threaded, which
> means you don't need to deal with weird async/event based models (see
> Kumar's post to this thread, which is spot on)
>
> Fapws, which spells "Fast Asynchronous Python Web Server" is very, very fast
> indeed, as it's mostly written in C -- however it's event based (used libev)
> so beware of blocking operations (e.g. network or file access) and slow
> Python code, which will bring your numbers down to numbers to mortal levels
>
> Tornado is an impressive contender here -- solid throughput even at high
> levels of concurrent requests; however, it's only slightly faster than
> CherryPy within "reasonable" levels of concurrent requests (10,000 or less)
> and, if you're a speed freak, you should consider Fapws, which blew the
> field away
>
> Obviously there's a lot behind the numbers, such as configuration, system
> under test, etc. Like I said, they're lies. If you have questions or, in
> particular, can help me make these go faster with smarter configuration,
> I'll happily rerun and publish. If you can make WEBrick (a Ruby server) go
> faster than my friend's golden retriever, which is trained to serve dynamic
> HTML, I'll buy you a beer.

Benchmarking Ruby in WEBRick is like benchmarking SimpleHTTPServer in
Python.  In other words, it's not really fair :)  You should set up
Phusion Passenger in Apache.  It's just as easy as Django / mod_wsgi
http://hackd.thrivesmarthq.com/how-to-setup-a-linux-server-for-ruby-on-rails-with-github-and-phusion-passenger
(you can probably ignore the SSH config)

btw, you don't need to use Rails for your example.  You can just make
a Rack application:
http://www.modrails.com/documentation/Users%20guide.html#_deploying_a_rack_based_ruby_application
 Rack is more or less Python's WSGI 2.0 ported to Ruby so it will be
familiar.

>
> As a final note, the tests themselves will be available with the Landshark
> download, once that's posted, so people can re-run the tests for themselves.
> Of course, it's not that hard to run ab against a hello world app.
>
> RPS = requests per second
> Time = average time in milliseconds to server each request
> Benchmark = `ab -t 10 -c <number of concurrent requests>-r http://localhost`
>
> 100 Concurrent Requests
> -----------------------
> =============== ====== ===========
> App Server         RPS   Time (ms)
> =============== ====== ===========
> Fapws             7174          14
> Landshark         4479          22
> PHP-5             4191          24
> Tomcat 6          3554          28
> Tornado           2641          38
> CherryPy WSGI     2102          48
> Jetty 6            937         107
> Django WSGI        785         129
> WEBrick             43        2350
> =============== ====== ===========
>
> 1,000 Concurrent Requests
> -------------------------
> =============== ====== ===========
> App Server         RPS   Time (ms)
> =============== ====== ===========
> Fapws             5359         187
> Landshark         4477         224
> PHP 5             3062         345
> Tomcat 6          3014         345
> Tornado           2452         409
> CherryPy WSGI     2126         470
> Jetty 6           1095         949
> Django WSGI        953        1057
> WEBrick             50       20607
> =============== ====== ===========
>
> 10,000 Concurrent Requests
> --------------------------
> =============== ====== ===========
> App Server         RPS   Time (ms)
> =============== ====== ===========
> Fapws             5213        1920
> Landshark         4239        2361
> Tomcat 6          2369        4752
> Tornado           2265        4439
> PHP 5             2239        4282
> CherryPy WSGI     1731        5786
> Jetty 6            794       13210
> Django WSGI        890       12330
> WEBrick             84      163425
> =============== ====== ===========
>
> 20,000 Concurrent Requests
> --------------------------
> =============== ====== ===========
> App Server         RPS   Time (ms)
> =============== ====== ===========
> Fapws             4788        4178
> Landshark         2936        6823
> Tornado           2153        9315
> PHP 5             1728       11578
> Tomcat 6          1362       15102
> CherryPy WSGI     1294       15477
> Django WSGI        790       27633
> Jetty 6            616       32492
> WEBrick             63      462464
> =============== ====== ===========
>
>
> On Thu, Sep 10, 2009 at 12:52 PM, Kumar McMillan <kumar.mcmillan at gmail.com>
> wrote:
>> This may be of interest to fellow Chipynauts:
>> http://developers.facebook.com/news.php?blog=1&story=301
>>
>> "FriendFeed's web server is a relatively simple, non-blocking web
>> server written in Python. The FriendFeed application is written using
>> a web framework that looks a bit like web.py or Google's webapp, but
>> with additional tools and optimizations to take advantage of the
>> non-blocking web server and tools."
>>
>> Docs: http://www.tornadoweb.org/documentation
>>
>> It uses epoll (from Linux kernel), interesting.
>> _______________________________________________
>> Chicago mailing list
>> Chicago at python.org
>> http://mail.python.org/mailman/listinfo/chicago
>>
>
>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
>
>


More information about the Chicago mailing list