guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ice-9 async-queue


From: Andy Wingo
Subject: Re: ice-9 async-queue
Date: Tue, 07 Feb 2012 09:44:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

On Mon 06 Feb 2012 23:57, address@hidden (Ludovic Courtès) writes:

> Andy Wingo <address@hidden> skribis:
>
>> I was thinking of adding the following to Guile, to eventually help make
>> the web server a little less terrible.  What do you think?
>
> An “asynchronous queue” is a queue of tasks, right?

It's a message queue for use in threads organized as producers and
consumers.

> What kind of tasks would it be: I/O?  Computation?

Depends on what you want to do.

> How does it fit with the web server?

The web server is single-threaded and uses blocking IO (though it does
poll(2) for keepalive).  As such, any slow writer or slow reader can
block the process.  Using non-blocking I/O is too difficult, for now.
So, threads.

I'd like to create a pool of threads for I/O.  Some threads would pop
ports off of the "to-read" queue, read request headers and bodies, then
push the requests onto a "to-process" queue.  Something (currently the
main thread) would process requests, and push them onto the "to-write"
queue.  IO threads would pop data (or closures) off of the to-write
queue, and write them to clients, possibly pushing the ports back on a
"to-keepalive" queue, which the poll loop would notice and add those fds
back to the poll set.

I'd also like to consider creating a separate pool of threads for
computation.  Obviously the size of these thread pools would be
different.  We could use futures for that, I suppose, but I'd like to
also be able to stop those threads, forcefully if needed, when the web
server stops.

Andy
-- 
http://wingolog.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]