TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Tornado: FriendFeed's non-blocking Python web server is now open source

291 pointsby finiteloopover 15 years ago

19 comments

tdavisover 15 years ago
This is more of a combination of a web <i>server</i> and a web <i>framework</i>, which is what I find fascinating about it. Twisted has had a web server forever, but despite a significant amount of experience in Twisted Land, I'd never write a full app using it! Add to that the (apparently) standalone low-level modules and we've got some seriously awesome tech that FriendFeed/Facebook have supplied for free.<p>Thanks a lot, fellas. Asynchronous networking programming in Python is somewhat of a bear so it's really nice to see a tool get released that improves it!
caseyover 15 years ago
An instance of the chat demo is running here: <a href="http://chan.friendfeed.com:8888/" rel="nofollow">http://chan.friendfeed.com:8888/</a><p>Website: <a href="http://www.tornadoweb.org/" rel="nofollow">http://www.tornadoweb.org/</a><p>Source: <a href="http://github.com/facebook/tornado/tree/master" rel="nofollow">http://github.com/facebook/tornado/tree/master</a>
评论 #816131 未加载
n8agrinover 15 years ago
Awesome to see more Python webservers coming to light, and fast ones at that. One observation though; anyone else notice that the bar chart is a bit misleading? It compares running Tornado in 4 processes behind nginx to running Django behind Apache and Cherrypy as a single Python process. As a fellow coworker put it, "With 4 extra processes running of course it will be 4 times as fast." I'm not opposed to this kind of comparison when the intent is to show how configurations can increase req/sec, but if the intent is to compare one Pythonic webserver to another, this comparison seems a bit unfair. That said, assuming the "Tornado (1 single-threaded frontend)" measure is simply Tornado running as a single Python process, it still is plenty faster than Cherrypy.
评论 #816136 未加载
评论 #815906 未加载
评论 #815908 未加载
n8agrinover 15 years ago
The templating system they developed looks pretty sweet <a href="http://github.com/facebook/tornado/blob/master/tornado/template.py" rel="nofollow">http://github.com/facebook/tornado/blob/master/tornado/templ...</a>.<p>Just played around with it a bit and it's basically what I want:<p>1) Simple and clear syntax (e.g. they use 'end' not endfor, endblock, etc)<p>2) Assign template variables to anything (including functions)<p>3) Don't over-restrict the author (e.g. they allow list comprehensions in if tags)<p>4) Block and extends statements.<p>Error handling seems to be a little clearer than other template languages though still not great:<p><a href="http://gist.github.com/184934" rel="nofollow">http://gist.github.com/184934</a><p>Clearly it's not going to be for everyone but after slogging around with Mako for the last year (&#60;%namespace:def /&#62; tags anyone?) this is like a breath of fresh air.
评论 #816510 未加载
RoboTeddyover 15 years ago
It 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.<p>Now 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 - <a href="http://www.python.org/dev/peps/pep-0342/" rel="nofollow">http://www.python.org/dev/peps/pep-0342/</a>). Unfortunately, I don't think there are any async Python mysql clients (PHP has one now - <a href="http://www.scribd.com/doc/7588165/mysqlnd-Asynchronous-Queries-and-more" rel="nofollow">http://www.scribd.com/doc/7588165/mysqlnd-Asynchronous-Queri...</a>)<p>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.
评论 #816509 未加载
评论 #817940 未加载
mapleoinover 15 years ago
Who wants a (unofficial for now) Fedora rpm ? [0] I just hacked this together in half an hour. Time to sleep now.<p>[0] <a href="http://mapleoin.fedorapeople.org/pkgs/tornado/tornado-0.1-1.fc11.noarch.rpm" rel="nofollow">http://mapleoin.fedorapeople.org/pkgs/tornado/tornado-0.1-1....</a>
cheriotover 15 years ago
Definitely rough around the edges, but looks like a great foundation.<p>A few notes: - template.py: "Error-reporting is currently... uh, interesting." - url mapping looks primitive - no form helpers - database.py looks decent, but is mysql only - Very nice to see the security considerations in signed cookies, auth, csrf protection.<p>Overall, it looks like they've done the trickier parts of building a web framework and left it to the user/community to add the parts web developers use most frequently (form &#38; url helpers, code organization, and orm).<p>I love Facebook's enlightened approach to open source. If only one of their open source projects takes off, it will benefit them tremendously.
xalover 15 years ago
I implemented the same idea in Ruby event machine: <a href="http://gist.github.com/184760" rel="nofollow">http://gist.github.com/184760</a><p>Obviously missing features (auth, nicks, scrolling) but that can all be added in a few mins.
评论 #816349 未加载
usaar333over 15 years ago
What exactly does 'non-blocking' mean in the context of a webserver?
评论 #816236 未加载
评论 #816259 未加载
评论 #817054 未加载
评论 #816246 未加载
ComputerGuruover 15 years ago
I've been looking for a good framework to begin serious web development on for someone coming from a decade-long career in desktop development (see the discussion at <a href="http://news.ycombinator.com/item?id=808191" rel="nofollow">http://news.ycombinator.com/item?id=808191</a>), and decided this release co-incides nicely with my newly-started quest and gave it a shot.<p>I 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 :)<p>Having a great time playing around with it... almost done with a basic forum system built on Tornado + Storm (<a href="https://storm.canonical.com/" rel="nofollow">https://storm.canonical.com/</a>).. I think I'm getting the hang of this whole web-development thing! :D
评论 #817187 未加载
calanizover 15 years ago
This looks great. I'm likely to look at it a little more in the future. I've been using Second Life's asyncrounous coroutine library called eventlet. I've implemented most of my code with a good lightweight framework that fits; restish. On top of that, I use spawning to manage my server processes. I myself have seen these kinds of numbers with my own app tests.
omouseover 15 years ago
Does this implement all of the HTTP 1.0 and 1.1 protocol specs? I'm kinda confused by the code :S
评论 #815845 未加载
drawkboxover 15 years ago
This is great for python, a proven web framework that was stressed on friend feed. Thanks ff team! I have been torn on my next python server project between web2py, cherrypy and django and I think I just decided.
评论 #816147 未加载
polviover 15 years ago
This is great. Any idea if they will do the same for the FriendFeed datastore?
评论 #816255 未加载
评论 #816253 未加载
dlsspyover 15 years ago
I could use this in apps today if it used twisted instead of reinventing it.
评论 #815771 未加载
statictypeover 15 years ago
What would be the advantage of using this over, say, lighttpd with one of the many existing python frameworks?<p>Does this web server offer any specific gains? Or is it just a question of personal taste?
austonover 15 years ago
At a first glance, this looks SERIOUSLY awesome!
prakashover 15 years ago
Bret, quick question. Does the framework support an esi type tags to abstract out personalized info? thanks!
评论 #816189 未加载
charlesjuover 15 years ago
Is this similar to EventMachine in Ruby?
评论 #815780 未加载
评论 #816095 未加载
评论 #816130 未加载