You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Juan Rivera <Ju...@citrix.com> on 2003/07/10 00:06:38 UTC

APR_BUCKET_BUFF_SIZE question

So currently Apache reads from the socket in APR_BUCKET_BUFF_SIZE chunks
(8000 bytes by default)

This value is a compiled value and can not be changed or configure at
runtime.

I was wondering if there is a particular reason not to make this
configurable in some way.

I was looking at the code and was thinking about a very simple way where we
can read in larger or smaller chunks. I does not seems like a lot of code to
change but I may be missing something.

So the way I would deal with this is first:

Make the apr_recv len parameter an input/output parameter instead of an
output parameter so we can tell it how much data we would like to read.

So if I set the value of len to something greater than 0 it would use that
value. If len is zero or less it would use APR_BUCKET_BUFF_SIZE.

In the code input filter, set the len value to readbytes or a configure
value, or if not use APR_BUCKET_BUFF_SIZE.

So we could have something like:

ReadBufferSize 8000

Or

ReadBufferSize 2000

Or

ReadBufferSize Dynamic # This will use the readbytes value instead.

That way a filter could ask for more or less bytes than the 8K.

This seems awfully simple and I'm sure I'm missing something to why we don't
do this already. Can somebody shed some light on this one?

Juan


Re: APR_BUCKET_BUFF_SIZE question

Posted by Cliff Woolley <jw...@virginia.edu>.
On Wed, 9 Jul 2003, Juan Rivera wrote:

> That way a filter could ask for more or less bytes than the 8K.

That's what apr_brigade_partition() is for.  Does that not get you what
you want?  And anyway, having a runtime-configurable buffer size would
make the bucket allocator WAY more complicated and less efficient...

--Cliff

Re: APR_BUCKET_BUFF_SIZE question

Posted by Joe Schaefer <jo...@sunstarsys.com>.
Juan Rivera <Ju...@citrix.com> writes:

[...]

> That way a filter could ask for more or less bytes than the 8K.

A filter can ask now- it just won't get more than 8K
per ap_get_brigade call.

FWIW, I think the best approach would be to put a loop
in httpd-2.0/server/core.c's core_input_filter(),  that 
would at least provide the core input filter with the
ability to yield brigades with more than one (8K) bucket.


-- 
Joe Schaefer