Facebook Open Sources FriendFeed's Real-Time Tech

jksfdWhen Facebook acquired FriendFeed last month, everyone knew it was getting some pretty impressive technology along with the obvious talent in the company. What people probably didn’t expect is that Facebook would open source a portion of it. But that’s what they’re doing today with the release of Tornado, a real-time web framework for Python, onto the web.

Another new Facebook addition, Dave Recordon, explains the open-sourcing today on Facebook’s Developers blog. That Recordon is the one doing this post isn’t all that surprising given his central role in the open source community. Here’s how he explains Tornado:

Tornado is a relatively simple, non-blocking Web server framework written in Python, designed to handle thousands of simultaneous connections, making it ideal for real-time Web services.

While Tornado is similar to existing Web-frameworks in Python (Django, Google’s webapp, web.py), it focuses on speed and handling large amounts of simultaneous traffic.

FriendFeed co-founder Bret Taylor has more on his own blog. He notes that in open sourcing Tornado, FriendFeed and Facebook hope that others will use it to build their own real-time web services. They have set up a demo of how it works at its most basic (commenting) here. As you can see, it looks a lot like the FriendFeed commenting system (pictured below).

Taylor lays out three key parts of Tornado:

All the basic site building blocks – Tornado comes with built-in support for a lot of the most difficult and tedious aspects of web development, including templates, signed cookies, user authentication, localization, aggressive static file caching, cross-site request forgery protection, and third party authentication like Facebook Connect. You only need to use the features you want, and it is easy to mix and match Tornado with other frameworks.

Screen shot 2009-09-10 at 10.48.21 AMReal-time services – Tornado supports large numbers of concurrent connections. It is easy to write real-time services via long polling or HTTP streaming with Tornado. Every active user of FriendFeed maintains an open connection to FriendFeed’s servers.

High performance – Tornado is pretty fast relative to most Python web frameworks. We ran some simple load tests against some other popular Python frameworks, and Tornado’s baseline throughput was over four times higher than the other frameworks:

But there’s more. Buried in Recordon’s explanation is the following:

Tornado is a core piece of infrastructure that powers FriendFeed’s real-time functionality, which we plan to actively maintain.

I’ve bolded the key part there. That would seem to suggest that Facebook is now committing to activity maintaining FriendFeed. While the FriendFeed co-founders have more or less said that the service would live on despite the Facebook deal, Facebook has been pretty mum on the topic up until now. Of course, Facebook could simply be saying that it will maintain the technology (for its own uses), and not the service.

Next question: How long until Twitter starts using some components of Tornado?

You can download and find out more about Tornado here.

Screen shot 2009-09-10 at 10.41.21 AM

[photo is an altered version of the great Toronado bar logo]

Screen shot 2009-09-10 at 10.51.15 AM