[dev] ngx.poll extension for mod_wsgi

Manlio Perillo manlio_perillo at libero.it
Wed Mar 26 22:37:41 MSK 2008


Hi.

For people interested I have designed and implemented an extension for 
my WSGI module for Nginx for better support of asynchronous applications.

Here are some examples:

1) An example of asynchronous query to a PostgreSQL database:
http://hg.mperillo.ath.cx/nginx/mod_wsgi/file/tip/examples/nginx-postgres-async.py

    The example make use of a connection pool that can grow indefinitely.

2) An example of HTTP proxy using pycurl:
http://hg.mperillo.ath.cx/nginx/mod_wsgi/file/tip/examples/nginx-curl.py

3) A very simple example on how to split a long calculation:
http://hg.mperillo.ath.cx/nginx/mod_wsgi/file/tip/examples/nginx-hash-async.py

4) A very simple example of asynchronous HTTP request
http://hg.mperillo.ath.cx/nginx/mod_wsgi/file/tip/examples/nginx-poll-sleep.py

   The application just "sleeps" for fixed amount of times until the
   request is done.




There are still problems and possible bugs.
I would really appreciate any suggestions about the API design; 
unfortunately people on the Python web-sig mailing list are not very 
interested in supporting asynchronous applications...


NOTE: the extension does not works with the rtsig event module, a 
segmentation fault occur.

The problem is that I simply make use of add_event and del_event, and 
the rtisig module does not defines these two operations (the add_event 
function pointer is NULL).





Thanks   Manlio Perillo





More information about the nginx mailing list