11 messages in com.googlegroups.pylons-discussRe: Asynchronous HTTP requests| From | Sent On | Attachments |
|---|---|---|
| jgar...@public.gmane.org | 26 Feb 2008 12:54 | |
| Ryan Wynn | 26 Feb 2008 13:14 | |
| jgar...@public.gmane.org | 26 Feb 2008 13:47 | |
| Matt Feifarek | 27 Feb 2008 12:45 | |
| Mike Orr | 27 Feb 2008 14:04 | |
| Matt Feifarek | 27 Feb 2008 14:27 | |
| Mike Orr | 27 Feb 2008 20:20 | |
| jgar...@public.gmane.org | 28 Feb 2008 15:26 | |
| Graham Dumpleton | 28 Feb 2008 15:39 | |
| Marcin Kasperski | 03 Mar 2008 03:57 | |
| Mike Orr | 03 Mar 2008 12:04 |
| Subject: | Re: Asynchronous HTTP requests![]() |
|---|---|
| From: | Mike Orr (slug...@public.gmane.org) |
| Date: | 02/27/2008 08:20:06 PM |
| List: | com.googlegroups.pylons-discuss |
On Wed, Feb 27, 2008 at 2:28 PM, Matt Feifarek
<matt...@public.gmane.org> wrote:
On Wed, Feb 27, 2008 at 5:04 PM, Mike Orr
<slug...@public.gmane.org> wrote:
Not sure what you mean by 'dispatch', because I don't think Routes or Pylons ever blocks, except the miniscule amount when importing modules. Your controller action can block (e.g., by making a database query), but that's its own fault.
It's in Jonathan's original post, in the comment pseudo code. Sorry for the confusion.
But it's worth pointing out that pylons' controller actions are not asynchronous out of the box. It's assumed that the whole action runs in one synchronous call, right? Or maybe there is something with internal with generators that could be used to slice up an expensive action into async-friendly action bits? (actionlets?)
Actually, I contradicted myself. I said I don't think Routes or Pylons blocks anywhere, and then said it would be a lot of work to get Pylons running under Twisted. Of course the first thing to do would be to see where Pylons does block. Since blocking has mainly to do with I/O, and the I/O is mainly in the server, I would guess that Pylons doesn't block much. Four areas are the Beaker and Mako cache files, reading the POST variables, and static files. Of course, it depends what you consider "blocking". Twisted considers local file I/O blocking; I wonder whether that really blocks long enough to be noticed. (Oh no, my other request was delayed for three milliseconds!) Of course, you could just run a Pylons app as-is with Twisted and see how bad the speed is.
Actually, that's not quite true. Twisted's WSGI wrapper runs in a thread, so it wouldn't be a fair comparision. You'd have to reimplement the wrapper to not start a thread and then measure the speed.with several concurrent requests.
For fun you could replace Beaker with whatever Twisted uses for sessions.
Database queries are also an issue. Twisted has a thin wrapper around DB-API. There's work to make SQLAlchemy usable but it wasn't finished last time I looked.
-- Mike Orr <slug...@public.gmane.org>




