代码很简单,不到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

Tornado是一个开源、可扩展且非阻塞的Web服务器及工具集,最初为支持FriendFeed的实时特性而开发。该框架非阻塞性质使其能够处理数千个并发连接,非常适合实时Web服务。Tornado采用了类似于web.py或Google Web App的设计,但加入了更多的工具和优化来利用底层非阻塞架构。

2523

被折叠的 条评论
为什么被折叠?



