What exactly does 'non-blocking' mean in the context of a webserver?
Tornado: FriendFeed's non-blocking Python web server is now open source
41–50 of 77 posts
Re: Tornado: FriendFeed's non-blocking Python web server is now open source
#42I realize Tornado isn't any different from the other Python frameworks with regards to coding style, etc. but the the fact that this framework comes complete with a web server means I don't have to worry about that part of the equation making developing Python-based webapps almost identical to developing a C++ library with one of the many HTML-based UI frontends :)
Having a great time playing around with it... almost done with a basic forum system built on Tornado + Storm (https://storm.canonical.com/).. I think I'm getting the hang of this whole web-development thing! :D
Re: Tornado: FriendFeed's non-blocking Python web server is now open source
#43I could use this in apps today if it used twisted instead of reinventing it.
How many deployed web apps really use Twisted? There are like 3 web packages in Twisted, most of which are really buggy, and as far as I could tell, barely used (even they acknowledge this, see http://twistedmatrix.com/trac/wiki/WebDevelopmentWithTwisted ). When we were developing this, we found that Twisted introduced as many problems as it solved in terms of incomplete features and bugs. The other protocols seem to…
This is sort of the point. twisted isn't a web framework. It's a networking framework. I work on a lot of really awesome networking projects that either don't have web interfaces (various xmpp services) or have ones that need work (buildbot).
Instead of filling an obviously missing hole in an existing framework, a new one was created that is missing all of the stuff that the other project has.
The twisted http client stuff is quite good. I used it along with a friend to build a tool that is a realtime (in the web sense) gateway between friendfeed and xmpp clients a couple days after the realtime API was released (before friendfeed launched their own). It works very well and I still use it today.
Unfortunately, if I wanted to build a tool that did similar stuff with a Tornado front-end, I'd have to write a new HTTP client that's compatible with Tornado's event loop (unless I'm mistaken).
Everything comes at a cost. Tornado demonstrably solved Friendfeed's problems quite well, but, as I stated above, I can't use it to solve my problems because even if I rewrote my apps, I'd lose all of the rest of twisted upon which I'm relying. e.g. I can't just bolt it onto buildbot (which would be so ideal as our web interface is suffering from lack of a framwork, but the backend is really good).
Re: Tornado: FriendFeed's non-blocking Python web server is now open source
#44I implemented the same idea in Ruby event machine: http://gist.github.com/184760 Obviously missing features (auth, nicks, scrolling) but that can all be added in a few mins.
Re: Tornado: FriendFeed's non-blocking Python web server is now open source
#45Now all we need are async data clients that tie into the Tornado event loop, and a clean way to yield control back and forth (perhaps with coroutines - http://www.python.org/dev/peps/pep-0342/). Unfortunately, I don't think there are any async Python mysql clients (PHP has one now - http://www.scribd.com/doc/7588165/mysqlnd-Asynchronous-Queri...)
A web app written like that would run like it's on fire. The event loop would just roll through everything asynchronously. You could even automatically batch together data calls across http requests to make things easier on the data tier.
Re: Tornado: FriendFeed's non-blocking Python web server is now open source
#46Is this similar to EventMachine in Ruby?
EM is a general-purpose library for nonblocking IO. Tornado is an HTTP server. In as much as they're both about nonblocking IO, they are similar.
Re: Tornado: FriendFeed's non-blocking Python web server is now open source
#47Just played around with it a bit and it's basically what I want:
1) Simple and clear syntax (e.g. they use 'end' not endfor, endblock, etc)
2) Assign template variables to anything (including functions)
3) Don't over-restrict the author (e.g. they allow list comprehensions in if tags)
4) Block and extends statements.
Error handling seems to be a little clearer than other template languages though still not great:
Clearly it's not going to be for everyone but after slogging around with Mako for the last year ( tags anyone?) this is like a breath of fresh air.
Re: Tornado: FriendFeed's non-blocking Python web server is now open source
#48Earlier quoted context omitted.
If you ran a single CherryPy instance, I don't see how that is possible. The Python global interpreter lock prevents a single process from making use of multiple cores.
No, it doesn't. I/O bound tasks can heavily use multiple cores just fine using threads.
Re: Tornado: FriendFeed's non-blocking Python web server is now open source
#49I implemented the same idea in Ruby event machine: http://gist.github.com/184760 Obviously missing features (auth, nicks, scrolling) but that can all be added in a few mins.
how about turning this to a full framework? or is there one already?
Re: Tornado: FriendFeed's non-blocking Python web server is now open source
#50It seems like blocking calls to data sources (the database, memcache, etc) would screw with a lot of the benefits of running the framework asynchronously. If your Tornado processes freeze while making synchronous backend requests, you're gonna need a lot of them, which probably kills a lot of the value. Now all we need are async data clients that tie into the Tornado event loop, and a clean way to yield control back…