The code is very simple, less than 5k lines. But the idea is good, changed to non-blocking after the efficiency is able to improve a lot, especially considering that the modern web app all need to communicate with other
HTTP server, blocking the price is too great.
Tornado is a open source version of the scalable, non-blocking Web server and tools, power FriendFeed. The FriendFeed application is written using a web framework this looks a bit like web.py or Google's WebApp, but with Addi tional tools and optimizations to take advantage of the underlying non-blocking.
The framework is distinct from most mainstream Web server frameworks (and certainly most Python frameworks) because it is non-blocking and reasonably fast. Because it is non-blocking and uses epoll, it can handle thousands of simultaneous standing, connections which it are Ideal for real-time Web services. We built the Web server specifically to handle FriendFeed ' s real-time features-every active user of FriendFeed maintains An open connection to the FriendFeed servers. (For further information on scaling servers to support thousands of clients, which is the c10k problem.)
The Tornado documentation for a detailed walkthrough the framework.
Tornado:facebook releases Python Framework as Open Source
Http://www.linux-magazine.com/Online/News/Tornado-Facebook-Releases-Python-Framework-as-Open-Source