[Twisted-web] Re: status of Twisted Web and Web 2

Manlio Perillo manlio_perillo at libero.it
Thu Mar 6 05:00:06 EST 2008


Nicola Larosa ha scritto:
> glyph at divmod.com wrote:
>> The worst thing about the current web confusion is that I think Twisted
>> would be that much *more* powerful if projects like Django could build
>> upon it; being the common lower-level of django, zope, cherrypy,
>> turbogears, and whatever else, would draw a lot of interest for Twisted,
>> and eliminate the need for the "don't use this piece of crap in a real
>> deployment" webservers that many of those projects currently come with.
> 
> Better integration between Twisted and Django has been on my todo list for
> quite a while. The current integration is done via WSGI and multithreading
> each whole request, which is not exactly the way one would like to use
> Twisted. ;-) Integration between Twisted and Zope is also currently done by
> multithreading each whole request, AFAIK.
> 
> Unfortunately Django code may block anywhere, so there's a lot of work
> trying to segment it in blocking and non-blocking parts, and hiding the
> blocking ones behind deferToThread calls.
> 

Maybe it can be of interest my work on adding asynchronous support in WSGI.

I'm developing a WSGI module for the Nginx web server:
http://hg.mperillo.ath.cx/nginx/mod_wsgi/

The great advantage of Nginx over Twisted is it's support for multiple 
worker processes; this helps a lot with application "reloading" and for 
better support of I/O bound applications.

However the number of worker processes is fixed, so if your application 
will wait "a lot" on I/O (like an HTTP request to a web application on 
the Internet) its a problem (well, this is a problem with preforked or 
multithreaded servers, too!).

So I have implemented a `ngx.poll` extension.
Some details can be found here:
http://mail.python.org/pipermail/web-sig/2008-March/003291.html

I'm fixing the latest problems, before pushing changes in the public 
repository.

I think that having a "pure" asynchronous WSGI implementation in Twisted 
Web that implements this extension can be a good starting point for 
trying to standardize asynchronous web applications.


P.S.: the wsgi.pause_output extension, proposed some years ago here by 
Donovan Preston should be very easy to implement using ngx.poll, and a pipe.





Regards   Manlio Perillo



More information about the Twisted-web mailing list