httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <>
Subject Re: Concatenation of small buckets in core_output_filter
Date Wed, 28 Nov 2001 06:15:54 GMT
On Mon, Nov 26, 2001 at 09:28:03AM -0800, Brian Pane wrote:
> * Rather than creating a temporary brigade for concatenation,
>   create a heap bucket.  Make it big enough to hold 8KB.  Pop
>   the small buckets from the brigade, concatenate their contents
>   into the heap bucket, and push the heap bucket onto the brigade.
> * If we end up in the concatenation again during the foreach loop
>   through the brigade, add the small buckets to the end of the
>   previously allocated heap bucket.  If the heap bucket size is
>   about to exceed 8KB, stop.
> Comments?

You could actually scan the whole brigade and replace small buckets with a
large heap bucket. For example: compress the first 20 5-byte buckets into a
single 100-byte bucket, skip the 10k file bucket, then compress the next 50
10-byte buckets into a 500-byte bucket.

The rule of thumb is simply "stop concatenating if you find a bucket bigger
than your threshold." Whether you skip over those looking for more is a
different question.

Note that apr_brigade_write() is fine if you're writing to the "end" of a
brigade. It doesn't work well "within", and it could also pose problems if
you trigger its flushing behavior. That said, if you're concatenating and
*moving* buckets (i.e. from the input brigade to a holding brigade), then
you're always writing at the end.

Also: why would this ever "exceed 8KB" ?? If that was the case, then you'd
just send the brigade to the network rather than try to hold onto it.

Finally: since you probably know the size of your concat-buffer, then you
can allocate the heap bucket to be the proper size, rather than use a
default 8k heap bucket.


Greg Stein,

View raw message