librelist archives

« back to archive

WSGI handler based on CherryPy's chunk-loving WSGI server and eventlet

WSGI handler based on CherryPy's chunk-loving WSGI server and eventlet

From:
Daniel Holth
Date:
2010-11-17 @ 05:18
Hello Mongrel2 users.

I was very interested in the project after learning how awesome ZeroMQ is.
So I took the CherryPy WSGI server and hacked it to support Mongrel2.

The combined powers of Mongrel2+ZeroMQ+eventlet process nearly 1800
requests/second on my AMD Athlon(tm) Dual Core Processor 5050e. Each request
is answered in its own greenthread. Chunked replies are supported for
streaming, and since each request has its own greenthread some interesting
things may be possible.


http://bitbucket.org/dholth/mongrel2_wsgi<https://bitbucket.org/dholth/mongrel2_wsgi>

"pip install hg+http://bitbucket.org/dholth/mongrel2_wsgi"

This is still a hack. Let me know how it works for you.

Thanks,

Daniel Holth

Re: [mongrel2] WSGI handler based on CherryPy's chunk-loving WSGI server and eventlet

From:
Zed A. Shaw
Date:
2010-11-18 @ 03:44
On Wed, Nov 17, 2010 at 12:18:42AM -0500, Daniel Holth wrote:
> The combined powers of Mongrel2+ZeroMQ+eventlet process nearly 1800
> requests/second on my AMD Athlon(tm) Dual Core Processor 5050e. Each request
> is answered in its own greenthread. Chunked replies are supported for
> streaming, and since each request has its own greenthread some interesting
> things may be possible.
> 
> 
http://bitbucket.org/dholth/mongrel2_wsgi<https://bitbucket.org/dholth/mongrel2_wsgi>

That's super cool, I'll put it on the mongrel2.org website, and I guess
this means I need to start crafting more language specific
documentation.

-- 
Zed A. Shaw
http://zedshaw.com/

Re: [mongrel2] WSGI handler based on CherryPy's chunk-loving WSGI server and eventlet

From:
Daniel Holth
Date:
2010-11-18 @ 04:32
And now ReloadWSGI is updated to support loading servers as well as just
WSGI applications. This is meaningful for my mongrel2_wsgi, where the ZeroMQ
superpowers allow more than one server to bind to the same socket at the
same time.

ReloadWSGI looks for changes in a Python program's source code and reloads
it automatically, but it actually waits for the new version to load before
killing the older version of the code. This only works if two copies of the
code can accept connections at the same time. (The previous ReloadWSGI
relied on the Unix feature of sharing sockets with fork()'d children.)

Since the old code is not killed, the application stays running in the face
of syntax errors (instead of having to drop into the shell to restart a less
robust reloader).