apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <cliffwool...@yahoo.com>
Subject Re: [PATCH] buckets sms phase 2
Date Tue, 04 Sep 2001 01:49:52 GMT
On Mon, 3 Sep 2001, Ryan Bloom wrote:

> I seriously dislike adding an SMS to every bucket.  I believe we are
> much better off just creating a per-thread free bucket list.  That
> keeps us from ever calling free while dealing with a request, and over
> time, we will stop calling malloc.

Okay, let's examine this option for a minute.  There are two ways to do
this: either the buckets code handles it or httpd handles it.  If the
buckets code handles it, you have to do the thread lookups we talked about
before, which is bad.  So that pretty much means it's up to the httpd to
handle it.  So what's the easiest way to do that?

You can have a list of apr_bucket's that can be reused easily enough--sort
of.  Once you grab your apr_bucket struct, what do you do with it?  You'd
have to rewrite the copy/split functions for all bucket types, because
none of them support an already-created apr_bucket.  Or you could add a
copy_into and split_into to the bucket API that take a pre-allocated
apr_bucket as a parameter.

You'd also have to wrap the make functions of all bucket types to replace
the built-in create functions.  That's even harder than the copy/split
functions, because the create functions for the different bucket types all
have different prototypes.  So you'd pretty much have to add a create_into
function for all bucket types.

Then there's the problem of the private data structures... you're pretty
much SOL there, unless you rewrite all of the make functions as well and
have a make_into for each one that takes some pre-allocated hunk o' memory
as a parameter (and hope it's big enough--how can the httpd ever know how
much memory a given bucket type requires?).  Other than that, you're stuck
letting the make functions keep on using malloc, which is on a guess
45-50% of the malloc calls that would remain.

So what we've ended up with is that we've almost doubled the size of the
bucket API so that the httpd can do the free-list work.

Are we even on the same wavelength?  Is this in fact what you had in mind?
If not, what?

--Cliff

--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA






Mime
View raw message