On Wed, Dec 10, 2003 at 03:18:44PM -0800, Stas Bekman wrote:
> Are you saying that if I POST N MBytes of data to the server and just have 
> the server send it back to me, it won't grow by that N MBytes of memory for 
> the duration of that request? Can you pipe the data out as it comes in? I 
> thought that you must read the data in before you can send it out (at least 
> if it's the same client who sends and receives the data).

Well, in the case of CGI, mod_cgi and mod_cgid currently require that
the CGI read in the entire body before mod_cgi(d?) will read the
response from the CGI.  So a CGI "echo" program must buffer the whole
response before mod_cgi(d?) will read the CGI output and send it back
to the client.  If the CGI buffers to disk, no problem, but if the
CGI buffers in memory, it will take a lot of memory (but not in Apache).

Obviously :-), that's a shortcoming of mod_cgi(d?), but might also be
a problem for modules such as mod_php which preprocesses the CGI POST
info before running the PHP script.

As Cliff said, with bucket brigades, it is possible to avoid such
problems and to process things in bite-size buckets.  Not all modules
do so, though.

Cheers,
Glenn

Reply via email to