Python:FriendFeed的Tornado Web Server

2018-01-31 12:06:36 浏览数 (1)

代码很简单,不到5k行。但是思路挺好的,改成non-blocking了之后效率就是能提高不少,特别是考虑到现代的web app都需要和其他的HTTP服务器通信,blocking的代价太大了。

Tornado is an open source version of the scalable, non-blocking web server and tools that power FriendFeed. The FriendFeed application is written using a web framework that looks a bit like web.py or Google's webapp, but with additional tools and optimizations to take advantage of the underlying non-blocking infrastructure. 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 means it is 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 more information on scaling servers to support thousands of clients, see The C10K problem.) See the Tornado documentation for a detailed walkthrough of 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

0 人点赞