11 messages in com.googlegroups.pylons-discussRe: Asynchronous HTTP requests
FromSent OnAttachments
jgar...@public.gmane.org26 Feb 2008 12:54 
Ryan Wynn26 Feb 2008 13:14 
jgar...@public.gmane.org26 Feb 2008 13:47 
Matt Feifarek27 Feb 2008 12:45 
Mike Orr27 Feb 2008 14:04 
Matt Feifarek27 Feb 2008 14:27 
Mike Orr27 Feb 2008 20:20 
jgar...@public.gmane.org28 Feb 2008 15:26 
Graham Dumpleton28 Feb 2008 15:39 
Marcin Kasperski03 Mar 2008 03:57 
Mike Orr03 Mar 2008 12:04 
Subject:Re: Asynchronous HTTP requests
From:Matt Feifarek (matt@public.gmane.org)
Date:02/27/2008 12:45:04 PM
List:com.googlegroups.pylons-discuss

On Tue, Feb 26, 2008 at 3:54 PM,
jgar@public.gmane.org < jgar@public.gmane.org> wrote:

Question: Is this likely to interfere with how Pylons is setup by default? Does it spawn threads for each request, or what happens?

Pylons does spawn threads; the size of the thread pool is configurable. Of course, if your dispatch blocks, then the pylons controller will block. If you expect to have many many requests all waiting a while on the reduce call, you may run out of threads that can answer new requests. I'm not sure what happens then; maybe a queue, maybe connections are refused.

Twisted handles this sort of thing as its core design principle. Unfortunately, the learning curve is something like a straight vertical line. And once you learn it (which is rewarding if you stick to it) it's VERY hard to mix in other code. Twisted doesn't play well with others, but it does supply loads of tools to do lots of things that you might want to do. It's pretty much one of those "drink the kool aid" things. Once you use Twisted, your app becomes a "twisted application" rather than a python application, pretty much.

I know that it's in theory possible to hook WSGI apps up to an async http (like Twisted) though I think it would require some pretty heavy plumbing work to get done. Maybe by now, someone has done it, so you could hook Pylons onto twisted (or the like).

These might be a good alternatives to look up: http://wiki.secondlife.com/wiki/Eventlet http://www.hackingthought.com/2008/01/new-fawps-libevent-httpd-and-python-c.html