Live data from Hacker News

Tornado 2.1 released

tornadoweb.org

11–20 of 36 posts

Re: Tornado 2.1 released

#11
post #2

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 ?

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

#12
post #2

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 ?

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.

Re: Tornado 2.1 released

#13
post #12

Earlier 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.

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 being serviced.

Re: Tornado 2.1 released

#14
post #13
post #12

Earlier 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…

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 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. 

  Bret

Re: Tornado 2.1 released

#15
post #14
post #13

Earlier 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…

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.

Re: Tornado 2.1 released

#16
For a multiplayer, realtime, text-based game, like a quiz, should I dive in nodejs or Tornado?

I know Python but never played with server-side javascript before.

Re: Tornado 2.1 released

#17
post #15
post #14

Earlier 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.

There's async libraries here: https://github.com/facebook/tornado/wiki/Links - You can get just about any db except MySQL. There's ones for Couch, Mongo, HBase, a bunch of other No-SQLs and Psycopg (PostGres).

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

#18
post #11

Earlier 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.

I've recently been blogging about my tornado-utils library which, for example, brings a email sending library similar to Djangos http://www.peterbe.com/oc-Tornado

Re: Tornado 2.1 released

#19
post #9

Coming 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 ....

I don't get it. Your example is what Tornado looks like::

  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
Tornado is intriguing, but the main thing I don't like about it is how it reinvents the wheel with a lot of its components. For example:

- 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.

Post reply on HN