Ed Loehr <[EMAIL PROTECTED]> writes:

> > [EMAIL PROTECTED] (Ed Loehr) wrote:
> > >Any ideas on why would this output statement takes 15-20 seconds to
> > >send a 120kb page to a browser on the same host?
> > >
> > >    $| = 1;  # Don't buffer anything...send it asap...
> > >    $r->print( $data );

You don't say how many lines your 120kb of data is. If it's about 40
characters per line average that's 30k calls to write (because you turned
buffering off). Calls to write ought to be around 100us but if they were slow
for some reason and took 500us then that would explain the 15s.

Additionally you're probably filling the kernel buffer and forcing a context
switch several times. If the buffer is about 4k then there would be 3k context
switches each about 10ms on linux, or about 30s of latency. There was a debate
over the usefulness of the ProxyReceiveBuffer parameter, and even that isn't
the same as this buffer, but it ought to be possible for Apache to setsockopt
to ask for a larger buffer.

In short, don't set $|=1, it will only slow down this process, and investigate
if there's any way to increase the size of the kernel buffer for the socket in
Apache. Lots of people would be interested to know if you turn up anything
there.


-- 
greg

Reply via email to