For those of you who want to get a little insight into how we make Brizzly run, we’ve decided to start sharing occasional technical posts like this one, written by star engineer Ben Darnell. Enjoy!
Here at Thing Labs, we’re always looking for ways to improve the performance of Brizzly. One important technique for real-time communication in web apps is “long polling,” where a web server keeps a connection open with a client until it has results to send back. Unfortunately, this technique came around after most web frameworks were designed so they’re not built to handle gobs of simultaneous connections efficiently. Because of this, we were excited by the release of the Tornado web framework. Tornado was originally developed at Friendfeed and released as open source by Facebook, and was designed to support long polling efficiently. Since December, Brizzly has been running on Tornado, with a growing number of features taking advantage of Tornado’s long polling capabilities.
Brizzly started out using the Django framework, and most of our code is in fact still based on Django. We have been converting pieces of the site one at a time based on where Tornado can add the most value, and we expect the two frameworks to coexist in Brizzly for some time.
Along the way, we have made a number of improvements to Tornado, many of which make it easier to migrate from one framework to Tornado or mix two frameworks in one app. These changes are now available in the Tornado git repository and will be available in the next release. For more information, read this post by Bret Taylor, Facebook’s director of products.