[Haskell-cafe] [GSoC] Student applications deadline extended one
week
Adam Langley
agl at imperialviolet.org
Mon Mar 31 19:09:33 EDT 2008
On Mon, Mar 31, 2008 at 12:00 PM, Manlio Perillo
<manlio_perillo at libero.it> wrote:
> Since Nginx is asynchronous, how can be solved the producer-consumer
> problem (that is, the Haskell program produces more data that Nginx can
> send to the client without blocking)?
I assume that the Haskell process is connected to nginx over a pipe or
socket. In which case, nginx can use flow control to block the sending
side of the pipe and the Haskell code will backup on that.
If many connections need to be multiplexed over the same
flow-controlled entity (i.e. a pipe), without head-of-line blocking
then you can just suspend the current thread using an MVar or the STM
objects.
Alternatively, with Network.MiniHTTP the problem is turned inside out.
Request handlers give return a Source object, which can be asked to
generate more data on request. This would be similar to generators in
Python.
AGL
--
Adam Langley agl at imperialviolet.org http://www.imperialviolet.org
More information about the Haskell-Cafe
mailing list