When and how to use Tornado? When is it useless?

There is a server and a webframework. When should we use framework and when can we replace it with other one?

This distinction is a bit blurry. If you are only serving static pages, you would use one of the fast servers like lighthttpd. Otherwise, most servers provide a varying complexity of framework to develop web applications. Tornado is a good web framework. Twisted is even more capable and is considered a good networking framework. It has support for lot of protocols.

Tornado and Twisted are frameworks that provide support non-blocking, asynchronous web / networking application development.

When should Tornado be used?
When is it useless?
When using it, what should be taken into account?

By its very nature, Async / Non-Blocking I/O works great when it is I/O intensive and not computation intensive. Most web / networking applications suits well for this model. If your application demands certain computational intensive task to be done then it has to be delegated to some other service that can handle it better. While Tornado / Twisted can do the job of web server, responding to web requests.

How can we make inefficient site using Tornado?

  1. Do any thing computational intensive task
  2. Introduce blocking operations

But I guess it’s not a silver bullet and if we just blindly run Django-based or any other site with Tornado it won’t give any performance boost.

Performance is usually a characteristic of complete web application architecture. You can bring down the performance with most web frameworks, if the application is not designed properly. Think about caching, load balancing etc.

Tornado and Twisted provide reasonable performance and they are good for building performant web applications. You can check out the testimonials for both twisted and tornado to see what they are capable of.

Leave a Comment