web2py with tornado instead of cherrypy

7 views
Skip to first unread message

Álvaro Justen [Turicas]

unread,
Sep 16, 2009, 12:41:15 AM9/16/09
to web2py-d...@googlegroups.com
Hi folks,
in PythonBrasil5[1] Douglas talked with me about tornado[2].

web2py + cherrypy without concurrent requests: 39.35 requests/sec
(mean time per request: 25.411 ms)
web2py + tornado without concurrent requests: 43.97 requests/sec (mean
time per request: 22.742 ms)

web2py + cherrypy with with 100 concurrent requests: 39.46
requests/sec (mean time per request: 25.340 ms)
web2py + tornado with 100 concurrent requests: 46.16 requests/sec
(mean time per request: 21.662 ms)

tornado versys cherrypy without concurrent requests: +11.75% faster
tornado versys cherrypy with 100 concurrent requests: +16.97% faster

What you need to do this experiment:
1- Download attached file main_tornado.py and replace gluon/main.py
with this file;
2- Download tornado, uncompress and copy directory 'tornado' (inside
'tornado-0.1' directory) and copy it to web2py's root directory.

I did not test my modification but for some tests, GET and POST with
query strings are working OK. To create other HTTP methods we need
only to add 'new_method = get' in MainHandler class.

What do you think?

[1] http://www.pythonbrasil.org.br/
[2] http://www.tornadoweb.org/

--
Álvaro Justen
Peta5 - Telecomunicações e Software Livre
21 3021-6001 / 9898-0141
http://www.peta5.com.br/

main_tornado.py

Massimo Di Pierro

unread,
Sep 16, 2009, 12:52:30 AM9/16/09
to alvaro...@gmail.com, web2py-d...@googlegroups.com

Thank you for this test. It is very valuable.

It seems to me the effect is too small to justify a change. In
particular considering that if one of the requests take long time to
process, cherrypy still handles the concurrent requests while tornado
(not multi threading) will block until the slow one is completed.

Massimo
> <main_tornado.py>

Reply all
Reply to author
Forward
0 new messages