90% made up my mind to use Tornado for several upcoming projects, would love to hear some comments (good or bad) from anyone thats used it or using it.
I've noticed that Tornado comes with its own MySQL wrapper, however I'm concerned it might have blocking issues. Does anyone have experience with using this ? Also, what do people use for form validation with Tornado ?
Tornado 2.1 released
11–20 of 36 posts
Re: Tornado 2.1 released
#1290% made up my mind to use Tornado for several upcoming projects, would love to hear some comments (good or bad) from anyone thats used it or using it.
I've noticed that Tornado comes with its own MySQL wrapper, however I'm concerned it might have blocking issues. Does anyone have experience with using this ? Also, what do people use for form validation with Tornado ?
The main advantage of async is not blocking if you call an external web API.
Re: Tornado 2.1 released
#13Earlier quoted context omitted.
I've noticed that Tornado comes with its own MySQL wrapper, however I'm concerned it might have blocking issues. Does anyone have experience with using this ? Also, what do people use for form validation with Tornado ?
The theory is, you shouldn't need async database access. If your database is a bottleneck, you are screwed, regardless of how your app layer is scaling. The main advantage of async is not blocking if you call an external web API.
Imagine an app that receives an HTTP request every second. One in five of these requests requires making a query that takes 3 seconds to complete. The rest is serviced immediately. You don't want the long request freezing your entire server and preventing the fast requests from being serviced.
Re: Tornado 2.1 released
#14Earlier quoted context omitted.
The theory is, you shouldn't need async database access. If your database is a bottleneck, you are screwed, regardless of how your app layer is scaling. The main advantage of async is not blocking if you call an external web API.
That sounds wrong. You need async database access so that while you're waiting for a query to finish, you can still process other requests. Imagine an app that receives an HTTP request every second. One in five of these requests requires making a query that takes 3 seconds to complete. The rest is serviced immediately. You don't want the long request freezing your entire server and preventing the fast requests from b…
We experimented with different async DB approaches, but settled on
synchronous at FriendFeed because generally if our DB queries were
backlogging our requests, our backends couldn't scale to the load
anyway. Things that were slow enough were abstracted to separate
backend services which we fetched asynchronously via the async HTTP
module.
I may open source the async MySQL client I wrote, but I am still
skeptical of the long term value given the code complexity it
introduces.
BretRe: Tornado 2.1 released
#15Earlier quoted context omitted.
That sounds wrong. You need async database access so that while you're waiting for a query to finish, you can still process other requests. Imagine an app that receives an HTTP request every second. One in five of these requests requires making a query that takes 3 seconds to complete. The rest is serviced immediately. You don't want the long request freezing your entire server and preventing the fast requests from b…
From this thread https://groups.google.com/forum/#!topic/python-tornado/mgj18... (posting here because Google Groups sometimes require login): We experimented with different async DB approaches, but settled on synchronous at FriendFeed because generally if our DB queries were backlogging our requests, our backends couldn't scale to the load anyway. Things that were slow enough were abstracted to separate backend serv…
Disclaimer: I wrote an async DB module for Twisted/PostgreSQL and it did not turn out to be all that complex.
Re: Tornado 2.1 released
#16I know Python but never played with server-side javascript before.
Re: Tornado 2.1 released
#17Earlier quoted context omitted.
From this thread https://groups.google.com/forum/#!topic/python-tornado/mgj18... (posting here because Google Groups sometimes require login): We experimented with different async DB approaches, but settled on synchronous at FriendFeed because generally if our DB queries were backlogging our requests, our backends couldn't scale to the load anyway. Things that were slow enough were abstracted to separate backend serv…
Erm, so if things are fast it doesn't matter and if things are slow you should write a whole new service, put a HTTP interface into it and use that? Not sure I buy that :) Disclaimer: I wrote an async DB module for Twisted/PostgreSQL and it did not turn out to be all that complex.
Also, Tornado is now introducing some kind of interface to Twisted's event loop, which does have everything ported.
Bret just doesn't seem to want async My-SQL in the main code base.
Re: Tornado 2.1 released
#18Earlier quoted context omitted.
I've noticed that Tornado comes with its own MySQL wrapper, however I'm concerned it might have blocking issues. Does anyone have experience with using this ? Also, what do people use for form validation with Tornado ?
I am curious about what kind of libraries are compatible with Tornado as well. Is there a list that someone maintains? I am specifically interested in things that can bring a bit of the goodies that django provides.
Re: Tornado 2.1 released
#19Coming from php(mvc background), the only thing i don't like about tornado is that basically you have a Class per request, currently i'm in a process to refactor this so that: www.site.com/controller/action/params/?vars -> would route to -> class controller(requestHandler): def get_action(self, *params, **vars): #do something self.write(response) def post_action2(self, *params, **vars): #.... and so on ....
class LoginHandler(RequestHandler):
def get(self):
self.render('login.html')
def post(self):
self.set_secure_cookie(self.get_argument('username'))
self.redirect('/')
Having one class per URL is very common and perhaps it's more than a decade of Python web programming but I like that. Makes for neat code.Re: Tornado 2.1 released
#20- They created a lot of Web-stuff parsing code themselves, when Werkzeug provides a tested and thorough implementation of a lot of that. (Especially routing, regex-based routing just looks horribly kludgy once you have used werkzeug.routing.)
- They created their own template language when they could have used Jinja. (In fact, tornado.template is basically a half-as-powerful copy of Jinja.)
- They created their own database access layer when they could have used SQLAlchemy instead.
Sometimes I think people take the concept of "minimal dependencies" way too far.