开发者

Python web server options with nonblocking architecture

开发者 https://www.devze.com 2023-03-03 01:42 出处:网络
I am looking for a Python based nonblocking web server environment that is designed to handle large number of simultaneous connections and be responsive under heavy load (C10K). I need it as a backend

I am looking for a Python based nonblocking web server environment that is designed to handle large number of simultaneous connections and be responsive under heavy load (C10K). I need it as a backend for my webapp. In a typical scenario the webapp client will be making several calls to the server using WebSockets.

So far I've found 2 options in python land.

  • TornadoWeb
  • Twisted

Outside python there is of course node.js, but I would prefer python coding environment if p开发者_如何学Cossible.

Which one of the above two (or others that I don't know) would you recommend? What are pros-cons? Or should I roll my own framework by writing some non-blocking frontend for web.py?

My concern is, although both the above projects seem to have good community support, they are not as mainstream as Django, CherryPy, Pylon etc. Therefore I am afraid of making a choice that may end up with poor support in future.


As one of the core Twisted developers, I will strongly recommend that you use Twisted. :)

First, because it is an excellent library with a development team committed to high quality software. Twisted has an extremely broad array of functionality to offer, ranging from a (well performing) simple web server to database integration (either thread-based on Twisted itself or thread-free in txmysql or txpostgres, distributed separately) to support for other protocols, like FTP, DNS, XMPP, SMTP, and many, many more. Yes, even WebSockets.

Second, because it is as good a solution to large scale network servers as you will find in Python. As you are familiar with C10K, I don't think I need to expound on this much. Suffice to say that Twisted has been used repeatedly in large scale systems to handle huge numbers of connections.

Third, because there is a large, active community that will not be going away any time soon which offers lots of support options. Taking the mailing list, IRC channel, and stackoverflow together, there's no shortage of ways to get help.


There are more good options. You should check a very good review of asynchronous python servers by Nicolas Piel.

0

精彩评论

暂无评论...
验证码 换一张
取 消