httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Gutierrez <>
Subject Re: mod_proxy buffering small chunks
Date Mon, 13 Feb 2006 20:48:45 GMT
* Plüm, Rüdiger, VIS <> [2006-02-06 09:29]:
> > -----Ursprüngliche Nachricht-----
> > Von: Alan Gutierrez 
> > 
> > The proposed solution is to poll for chunks using 
> > non-blocking I/O. When the socket returns EAGAIN, the 8K 
> > buffer is flushed, and the socket is read with blocking I/O.
> Thats the way the code is already designed in 2.2.x.

I am aware of this, acutally. I should have noted this myself.

I've traced through the code to see where the EAGAIN return value is
lost, and to note that the non-blocking mode is not applied to the
header. I've not tested, but I suspect that the logic is correctly
implemented should the socket block during the transfer of the body
of a chunk. It fails when the next chunk has not been sent.

> > However, in the http code, regardless of the block mode flag, 
> > the headers are read using blocking I/O. Furthermore, 
> > somewhere deeper in the chain, when EAGAIN is detected the 
> > success flag is returned instead. I'll provide more detail, 
> > if this is not already well known.

> This is the problem. The EAGAIN or better the mode handling in this
> code path is somewhat broken.

Looks that way. The EAGAIN is never sent back out, and in addition
the headers are read with a blocking read. It would require changing
the return values of code path, which may way cause some breakage.

Maybe not, if EAGAIN is handled correctly in all places, but it's
never been tested, since it's never returned, right?

> > Looks like this is going to be messy to fix. Any patches?
> Not so far. I guess it requires some general changes that must
> be carefully designed. But anyway, patch proposals are welcome :-).

Can I suggest a flag? Something like

ProxyChunkedAsIs On

If this could be specified for a path or directory, then the
upstream chunks are sent immediately, no buffering what so ever.

This is a patch I've applied partially, need to add the flag. Adding
the behavior fixes my problem.

I'm proxying a stock ticker. The chunk size is always going to be
smaller than 8k. Even when the EAGAIN logic is implemented
correctly, buffering is liable to delay the receipt of the chunk.

> Actually, the thing you want works with mod_proxy_ajp in 2.2.x.

AJP? Confusing. Wish I could keep it HTTP.

Alan Gutierrez - 504 717 1428 - -

View raw message