httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Graham Leggett <minf...@sharp.fm>
Subject Re: cache: the store_body interface
Date Mon, 30 Oct 2006 18:53:58 GMT
Justin Erenkrantz wrote:

>> 1) change the store_body interface to allow the storage provider direct
>> access to f->next, so it can flush buckets up the output filter chain
>> when they have been stored.  As seen on trunk.
>>
>> 2) keep the interface as-is, but read buckets in mod_cache and partition
>> the brigade manually; only pass a "small" brigade with known-length
>> buckets to the provider. (so no morphing and no arbitrary memory
>> consumption)
>>
>> 3) change the interface: deal with the buckets entirely in mod_cache and
>> just pass (char *,size_t) pairs to store_body
>>
>> 4) change the interface: pass some abstract "flush-me" callback in,
>> which the provider can call to pass up then delete the bucket.
>> (apr_brigade_flush doesn't quite fit the bill unfortunately)
>>
>> IMO:
>>
>> if you're going to be reading buckets from the brigade in mod_cache, you
>> might as well go the whole hog and do (3), and stop exposing the
>> provider to buckets or brigades at all.  This will prevent the provider
>> from doing any particular optimisations based on content type (like
>> copying FILE buckets); feature or bug, take your pick.
> 
> #3 gets my vote.  I hate bucket brigades anyway.  ;-)

Thinking about this a bit, the fact that buckets can be "too weird" at 
times, and every cache provider has to now care about this weirdness 
while caching, letting mod_cache deal with the weirdness and letting the 
cache providers deal with a trivial buffer is probably the way to go.

#3 it is.

> The problem with #1 is that the failure case gets too goofy as it'd be
> hard to recover from failure (what I labeled as #5 in our list of
> principles).  -- justin

The failure case I found was actually simple - you simply aren't allowed 
to. You just log the error, clean up the half-cached-entry, tell the 
filter to step out the way, and pass the brigade up the stack so the 
client can continue as if nothing had happened.

Of course this doesn't stop future module writers assuming they should 
return a cached error status, as this is the standard case everywhere 
else in the code.

Regards,
Graham
--

Mime
View raw message