You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dirk-Willem van Gulik <di...@webweaving.org> on 2008/02/05 19:45:21 UTC

store_headers in memcache and diskcache

Caching experts --  why do memcache and diskcache have seemingly quite  
different caching strategies when it comes to storing the headers ?  
E.g. the cache_object_t * is populated with the status/date/etc data  
in memcache - but not in disk-cache. Is this work in progress or  
subtle design ?

I am trying to understand (got  a working mod_memcached_cache.c* --  
and cannot quite get the right VARY behaviour).

Thanks,

Dw.

*: using apr_memcache and a bit more generalized glue as to reduce the  
overlap with the mod_ssl memcache backend. As to then be able to layer  
in (lib)ketama (robust hashing) and ultimately plug-able cache  
invalidation.

Re: store_headers in memcache and diskcache

Posted by Ruediger Pluem <rp...@apache.org>.

On 02/09/2008 06:10 PM, Dirk-Willem van Gulik wrote:
> 
> On Feb 9, 2008, at 6:06 PM, Justin Erenkrantz wrote:
> 
>> On Feb 9, 2008 6:00 PM, Dirk-Willem van Gulik <di...@webweaving.org> 
>> wrote:
>>> Whichever is easiest. Happy to plop it in there at google. As it has a
>>> while to go before we should/could offer this for inclusion at httpd/
>>> apache.
>>
>> Well, it could be fleshed out in trunk - it won't be backported to
>> 2.2.x (at least not soon), but there's no reason to keep it out of our
>> tree - especially if you keep talking about it on dev@httpd.  =)  --
>> justin
> 
> Hmm - we already have an underloved mod_memcache there -- and ideally a 
> fair chunk of code in mod_disk_cache which really should migrate 'up' 
> into mod_cache and cache_utils before we can clean up (even) mod_memcache.

How about a development branch instead?

Regards

Rüdiger


Re: store_headers in memcache and diskcache

Posted by Dirk-Willem van Gulik <di...@webweaving.org>.
On Feb 9, 2008, at 6:06 PM, Justin Erenkrantz wrote:

> On Feb 9, 2008 6:00 PM, Dirk-Willem van Gulik <di...@webweaving.org>  
> wrote:
>> Whichever is easiest. Happy to plop it in there at google. As it  
>> has a
>> while to go before we should/could offer this for inclusion at httpd/
>> apache.
>
> Well, it could be fleshed out in trunk - it won't be backported to
> 2.2.x (at least not soon), but there's no reason to keep it out of our
> tree - especially if you keep talking about it on dev@httpd.  =)  --
> justin

Hmm - we already have an underloved mod_memcache there -- and ideally  
a fair chunk of code in mod_disk_cache which really should migrate  
'up' into mod_cache and cache_utils before we can clean up (even)  
mod_memcache.

Dw



Re: store_headers in memcache and diskcache

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Feb 9, 2008, at 12:06 PM, Justin Erenkrantz wrote:

> On Feb 9, 2008 6:00 PM, Dirk-Willem van Gulik <di...@webweaving.org>  
> wrote:
>> Whichever is easiest. Happy to plop it in there at google. As it  
>> has a
>> while to go before we should/could offer this for inclusion at httpd/
>> apache.
>
> Well, it could be fleshed out in trunk - it won't be backported to
> 2.2.x (at least not soon), but there's no reason to keep it out of our
> tree - especially if you keep talking about it on dev@httpd.  =)  --
> justin
>

+1

Re: store_headers in memcache and diskcache

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
On Feb 9, 2008 6:00 PM, Dirk-Willem van Gulik <di...@webweaving.org> wrote:
> Whichever is easiest. Happy to plop it in there at google. As it has a
> while to go before we should/could offer this for inclusion at httpd/
> apache.

Well, it could be fleshed out in trunk - it won't be backported to
2.2.x (at least not soon), but there's no reason to keep it out of our
tree - especially if you keep talking about it on dev@httpd.  =)  --
justin

Re: store_headers in memcache and diskcache

Posted by Dirk-Willem van Gulik <di...@webweaving.org>.
On Feb 9, 2008, at 5:36 AM, josh rotenberg wrote:

> Dirk, my comments inline ...
>
> On Feb 8, 2008 11:19 AM, Dirk-Willem van Gulik  
> <di...@webweaving.org> wrote:
> .. snip snip ..
>
>> Ok - more or less merged a lot between both modules (2) --- al the
>> good bits are yours :) Does that make sense to you ?
>
> Hah! Then there is a lot of work to do!

Agreed - next step (I guess)  is to isolate all the good things in mod- 
disk-cache; such as the two level hash on Vary - move this into  
general mod_cache and cache_util.c (i.e. to make sure that when you  
get a store_headers/body -- the vary info is handed to you on a silver  
platter already -- the server knows best). So that all cache modules  
can benefit here.

..
>> -       create/open -- we could fetch it all already then.
>> -       Or defer to the actual header/body routines - as you and I  
>> do now.
>>
>> -       Or just 'punt' and store the thing as one big wack - as  
>> generally
>> you are
>>        propably going to need both ?
>
> I struggled with this one a lot. In some ways an all or nothing
> approach seems better. Less setting and getting, its there or its not.

Ok - I'll run some tests on a real server; to see what % gets headers  
but not bodies.

> I guess I was mainly trying to follow the mod_disk_cache model, and in
> some ways conform to what the provider api for caching seems to
> assume, that the two are separate. I think I was also discussing with
> someone the possibility of having body data auto-populate in the cache
> (via something completely outside of apache) and it sounded cool to be
> able to dump content into the cache without having to worry about
> faking up a header entry. And/or the possibility of allowing headers

Right -- and/or having an external process (or even a near zero cost  
listener) be able to update or invalidate entries.

> and bodies to be stored in different servers/pools, so that perhaps
> header info is expiring or LRU'ing at a different rate. Just thoughts,
> really, though, not sure if it makes sense to overdesign for it.
>
> If you want to collaborate on the google project let me know and I can
> add you, or you can take over, or however.


Whichever is easiest. Happy to plop it in there at google. As it has a  
while to go before we should/could offer this for inclusion at httpd/ 
apache.

Dw

Re: store_headers in memcache and diskcache

Posted by Rich Bowen <rb...@rcbowen.com>.
On Feb 9, 2008, at 18:57, josh rotenberg wrote:

> Seems like switching the names around a la mod_proxy would sound
> better: mod_cache_disk, mod_cache_mem, mod_cache_memcached, etc.

+1 for these sensible names. mod_proxy_* and mod_cache_* makes more  
sense.

--
A poet more than thirty years old is simply an overgrown child.
H. L. Mencken


Re: store_headers in memcache and diskcache

Posted by josh rotenberg <jo...@gmail.com>.
On Feb 9, 2008 4:18 PM, Issac Goldstand <ma...@beamartyr.net> wrote:
> josh rotenberg wrote:
> > Seems like switching the names around a la mod_proxy would sound
> > better: mod_cache_disk, mod_cache_mem, mod_cache_memcached, etc.
> >
>
> Ack.  Pain in the ass....   But the man speaks sense.  Really not so
> happy with doing it now - even as a major bump...
>
> My personal opinions:
> +1 on 3.x
> -0 on 2.4
>
>   Issac

Yeah, not really a short term expectation, just sayin' really ...

Re: store_headers in memcache and diskcache

Posted by Issac Goldstand <ma...@beamartyr.net>.
josh rotenberg wrote:
> Seems like switching the names around a la mod_proxy would sound
> better: mod_cache_disk, mod_cache_mem, mod_cache_memcached, etc.
>   

Ack.  Pain in the ass....   But the man speaks sense.  Really not so
happy with doing it now - even as a major bump...

My personal opinions:
+1 on 3.x
-0 on 2.4

  Issac

Re: store_headers in memcache and diskcache

Posted by josh rotenberg <jo...@gmail.com>.
On Feb 9, 2008 9:04 AM, Justin Erenkrantz <ju...@erenkrantz.com> wrote:
> On Feb 9, 2008 5:36 AM, josh rotenberg <jo...@gmail.com> wrote:
> > If you want to collaborate on the google project let me know and I can
> > add you, or you can take over, or however.
>
> Or, better yet, how about adding mod_memcache_cache (gah - crappy
> name) to trunk?  There's no real reason why we shouldn't have it if
> there are interested developers to work and maintain it.  -- justin
>

Seems like switching the names around a la mod_proxy would sound
better: mod_cache_disk, mod_cache_mem, mod_cache_memcached, etc.

I don't have a problem with putting it in trunk assuming its a good
candidate  (I'll just have to get someone to apply my patches if I
keep working on it).

Josh

Re: store_headers in memcache and diskcache

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
On Feb 9, 2008 5:36 AM, josh rotenberg <jo...@gmail.com> wrote:
> If you want to collaborate on the google project let me know and I can
> add you, or you can take over, or however.

Or, better yet, how about adding mod_memcache_cache (gah - crappy
name) to trunk?  There's no real reason why we shouldn't have it if
there are interested developers to work and maintain it.  -- justin

Re: store_headers in memcache and diskcache

Posted by josh rotenberg <jo...@gmail.com>.
Dirk, my comments inline ...

On Feb 8, 2008 11:19 AM, Dirk-Willem van Gulik <di...@webweaving.org> wrote:
.. snip snip ..

> Ok - more or less merged a lot between both modules (2) --- al the
> good bits are yours :) Does that make sense to you ?

Hah! Then there is a lot of work to do!

> Issues I am particularly torn over are:
>
> -       change from re-alloc to brigades -- but this means we have 100-500k
> chunks sitting in memory 2x or 3x
>
>         ---> ultimately perhaps apr_memcache needs to understands the
> brigades perhaps.

I thought a lot about this, actually. An
apr_memcache_(set|get)_brigade or something would be handy. I was also
really wishing for the memcached 'append' command, which didn't exist
at the time. If we check the version on server init it could do one or
the other.

> -       passing of the info glob -- I guess we should make it perhaps number
> \0number\0 or something for convenience and speed ?

Yeah, agreed. I'm not particularly happy/bound to my serialization of
the info and headers, its not the most optimal solution. My goals at
the time were basically to make it work, and to some degree make it
human readable for testing.

> -       I am making MD5 keys -- you are trusting the URI. What is best
> really ?

Again, I was mainly trying to keep things simple for testing, so I
have no issue with a better alternative.


> -       create/open -- we could fetch it all already then.
> -       Or defer to the actual header/body routines - as you and I do now.
>
> -       Or just 'punt' and store the thing as one big wack - as generally
> you are
>         propably going to need both ?

I struggled with this one a lot. In some ways an all or nothing
approach seems better. Less setting and getting, its there or its not.
I guess I was mainly trying to follow the mod_disk_cache model, and in
some ways conform to what the provider api for caching seems to
assume, that the two are separate. I think I was also discussing with
someone the possibility of having body data auto-populate in the cache
(via something completely outside of apache) and it sounded cool to be
able to dump content into the cache without having to worry about
faking up a header entry. And/or the possibility of allowing headers
and bodies to be stored in different servers/pools, so that perhaps
header info is expiring or LRU'ing at a different rate. Just thoughts,
really, though, not sure if it makes sense to overdesign for it.

If you want to collaborate on the google project let me know and I can
add you, or you can take over, or however.

Thanks,

Josh

Re: store_headers in memcache and diskcache

Posted by Dirk-Willem van Gulik <di...@webweaving.org>.
Josh,

On Feb 8, 2008, at 5:18 PM, Dirk-Willem van Gulik wrote:

> On Feb 6, 2008, at 10:26 PM, josh rotenberg wrote:
>
>> grr, this cold is making me dumber than usual. the link:
>>
>> http://code.google.com/p/modmemcachecache/
>
> Shame I did not discover your code before !
>
> Mine(1) looks fairly very similar - Except I sort of started with  
> apr_brigade_pflatten() as well - but then removed it to see if that  
> would let me cut off things which are too large earlier - and then  
> got into the mess of re-allocing and what not. But that was propably  
> the wrong path. Let me see if I can merge things a bit.

Ok - more or less merged a lot between both modules (2) --- al the  
good bits are yours :) Does that make sense to you ?

Issues I am particularly torn over are:

-	change from re-alloc to brigades -- but this means we have 100-500k  
chunks sitting in memory 2x or 3x

	---> ultimately perhaps apr_memcache needs to understands the  
brigades perhaps.

-	passing of the info glob -- I guess we should make it perhaps number 
\0number\0 or something for convenience and speed ?

-	I am making MD5 keys -- you are trusting the URI. What is best  
really ?

-	create/open -- we could fetch it all already then.

-	Or defer to the actual header/body routines - as you and I do now.

-	Or just 'punt' and store the thing as one big wack - as generally  
you are
	propably going to need both ?

-	Or should we get more clever and make the "Key" not just the URI but  
everything
	under VARY -- but if we do that -- we should really do that for  
mod_cache so
	that all modules would benefit - i.e. mod_disk_cache.

What are your thoughts ?

Dw

> 1: http://www.webweaving.org/tmp/mod_memcached-hack.c


2 ttp://www.webweaving.org/tmp/mod_memcached-hack-2.c



Re: store_headers in memcache and diskcache

Posted by Dirk-Willem van Gulik <di...@webweaving.org>.
On Feb 6, 2008, at 10:26 PM, josh rotenberg wrote:

> grr, this cold is making me dumber than usual. the link:
>
> http://code.google.com/p/modmemcachecache/

Shame I did not discover your code before !

Mine(1) looks fairly very similar - Except I sort of started with  
apr_brigade_pflatten() as well - but then removed it to see if that  
would let me cut off things which are too large earlier - and then got  
into the mess of re-allocing and what not. But that was propably the  
wrong path. Let me see if I can merge things a bit.

Dw

1: http://www.webweaving.org/tmp/mod_memcached-hack.c

>
>
> On Feb 6, 2008 1:25 PM, josh rotenberg <jo...@gmail.com>  
> wrote:
>> if it helps at all, here was my attempt at a working
>> mod_memcached_cache. i've been meaning to look at it again and do  
>> some
>> cleanup/testing/benchmarking/etc, haven't had the chance though.
>>
>>
>>
>>
>> On Feb 5, 2008 11:17 AM, Dirk-Willem van Gulik  
>> <di...@webweaving.org> wrote:
>>>
>>>
>>> On Feb 5, 2008, at 7:58 PM, Colm MacCarthaigh wrote:
>>>
>>>> On Tue, Feb 05, 2008 at 01:49:43PM -0500, Garrett Rooney wrote:
>>>>> On Feb 5, 2008 1:45 PM, Dirk-Willem van Gulik
>>>>> <di...@webweaving.org> wrote:
>>>>>> Caching experts --  why do memcache and diskcache have seemingly
>>>>>> quite
>>>>>> different caching strategies when it comes to storing the  
>>>>>> headers ?
>>>>>> E.g. the cache_object_t * is populated with the status/date/etc  
>>>>>> data
>>>>>> in memcache - but not in disk-cache. Is this work in progress or
>>>>>> subtle design ?
>>>>>>
>>>>>> I am trying to understand (got  a working  
>>>>>> mod_memcached_cache.c* --
>>>>>> and cannot quite get the right VARY behaviour).
>>>>>
>>>>> If I had to guess I'd say it's because people have actually been
>>>>> working on disk cache, while mem cache has been largely ignored  
>>>>> for a
>>>>> while.
>>>>
>>>> Definitely! I remember the original patches tried to create some  
>>>> nice
>>>> abstractions so that more logic would move into mod_cache propery  
>>>> than
>>>> in mod_*_cache, but there turned out to be so many corner cases  
>>>> within
>>>> mod_disk_cache itself - and noone seems to /use/ mod_mem_cache -  
>>>> that
>>>> that fell by the wayside :/
>>>
>>> Thanks ! That is useful info -- so for now I'll focus on
>>> mod_disk_cache -- and once I got that mapped to mod_memcached --  
>>> will
>>> then see if we can abstract that into a cleaner mod_memcache. But
>>> first priority is getting it clean-ish/same-ish relative to the ssl
>>> use of memcached (my usecase is OpenID -- which is 'heavy' on both).
>>>
>>> Dw
>>>
>>


Re: store_headers in memcache and diskcache

Posted by josh rotenberg <jo...@gmail.com>.
grr, this cold is making me dumber than usual. the link:

http://code.google.com/p/modmemcachecache/

On Feb 6, 2008 1:25 PM, josh rotenberg <jo...@gmail.com> wrote:
> if it helps at all, here was my attempt at a working
> mod_memcached_cache. i've been meaning to look at it again and do some
> cleanup/testing/benchmarking/etc, haven't had the chance though.
>
>
>
>
> On Feb 5, 2008 11:17 AM, Dirk-Willem van Gulik <di...@webweaving.org> wrote:
> >
> >
> > On Feb 5, 2008, at 7:58 PM, Colm MacCarthaigh wrote:
> >
> > > On Tue, Feb 05, 2008 at 01:49:43PM -0500, Garrett Rooney wrote:
> > >> On Feb 5, 2008 1:45 PM, Dirk-Willem van Gulik
> > >> <di...@webweaving.org> wrote:
> > >>> Caching experts --  why do memcache and diskcache have seemingly
> > >>> quite
> > >>> different caching strategies when it comes to storing the headers ?
> > >>> E.g. the cache_object_t * is populated with the status/date/etc data
> > >>> in memcache - but not in disk-cache. Is this work in progress or
> > >>> subtle design ?
> > >>>
> > >>> I am trying to understand (got  a working mod_memcached_cache.c* --
> > >>> and cannot quite get the right VARY behaviour).
> > >>
> > >> If I had to guess I'd say it's because people have actually been
> > >> working on disk cache, while mem cache has been largely ignored for a
> > >> while.
> > >
> > > Definitely! I remember the original patches tried to create some nice
> > > abstractions so that more logic would move into mod_cache propery than
> > > in mod_*_cache, but there turned out to be so many corner cases within
> > > mod_disk_cache itself - and noone seems to /use/ mod_mem_cache - that
> > > that fell by the wayside :/
> >
> > Thanks ! That is useful info -- so for now I'll focus on
> > mod_disk_cache -- and once I got that mapped to mod_memcached -- will
> > then see if we can abstract that into a cleaner mod_memcache. But
> > first priority is getting it clean-ish/same-ish relative to the ssl
> > use of memcached (my usecase is OpenID -- which is 'heavy' on both).
> >
> > Dw
> >
>

Re: store_headers in memcache and diskcache

Posted by josh rotenberg <jo...@gmail.com>.
if it helps at all, here was my attempt at a working
mod_memcached_cache. i've been meaning to look at it again and do some
cleanup/testing/benchmarking/etc, haven't had the chance though.



On Feb 5, 2008 11:17 AM, Dirk-Willem van Gulik <di...@webweaving.org> wrote:
>
>
> On Feb 5, 2008, at 7:58 PM, Colm MacCarthaigh wrote:
>
> > On Tue, Feb 05, 2008 at 01:49:43PM -0500, Garrett Rooney wrote:
> >> On Feb 5, 2008 1:45 PM, Dirk-Willem van Gulik
> >> <di...@webweaving.org> wrote:
> >>> Caching experts --  why do memcache and diskcache have seemingly
> >>> quite
> >>> different caching strategies when it comes to storing the headers ?
> >>> E.g. the cache_object_t * is populated with the status/date/etc data
> >>> in memcache - but not in disk-cache. Is this work in progress or
> >>> subtle design ?
> >>>
> >>> I am trying to understand (got  a working mod_memcached_cache.c* --
> >>> and cannot quite get the right VARY behaviour).
> >>
> >> If I had to guess I'd say it's because people have actually been
> >> working on disk cache, while mem cache has been largely ignored for a
> >> while.
> >
> > Definitely! I remember the original patches tried to create some nice
> > abstractions so that more logic would move into mod_cache propery than
> > in mod_*_cache, but there turned out to be so many corner cases within
> > mod_disk_cache itself - and noone seems to /use/ mod_mem_cache - that
> > that fell by the wayside :/
>
> Thanks ! That is useful info -- so for now I'll focus on
> mod_disk_cache -- and once I got that mapped to mod_memcached -- will
> then see if we can abstract that into a cleaner mod_memcache. But
> first priority is getting it clean-ish/same-ish relative to the ssl
> use of memcached (my usecase is OpenID -- which is 'heavy' on both).
>
> Dw
>

Re: store_headers in memcache and diskcache

Posted by Dirk-Willem van Gulik <di...@webweaving.org>.
On Feb 5, 2008, at 7:58 PM, Colm MacCarthaigh wrote:

> On Tue, Feb 05, 2008 at 01:49:43PM -0500, Garrett Rooney wrote:
>> On Feb 5, 2008 1:45 PM, Dirk-Willem van Gulik  
>> <di...@webweaving.org> wrote:
>>> Caching experts --  why do memcache and diskcache have seemingly  
>>> quite
>>> different caching strategies when it comes to storing the headers ?
>>> E.g. the cache_object_t * is populated with the status/date/etc data
>>> in memcache - but not in disk-cache. Is this work in progress or
>>> subtle design ?
>>>
>>> I am trying to understand (got  a working mod_memcached_cache.c* --
>>> and cannot quite get the right VARY behaviour).
>>
>> If I had to guess I'd say it's because people have actually been
>> working on disk cache, while mem cache has been largely ignored for a
>> while.
>
> Definitely! I remember the original patches tried to create some nice
> abstractions so that more logic would move into mod_cache propery than
> in mod_*_cache, but there turned out to be so many corner cases within
> mod_disk_cache itself - and noone seems to /use/ mod_mem_cache - that
> that fell by the wayside :/

Thanks ! That is useful info -- so for now I'll focus on  
mod_disk_cache -- and once I got that mapped to mod_memcached -- will  
then see if we can abstract that into a cleaner mod_memcache. But  
first priority is getting it clean-ish/same-ish relative to the ssl  
use of memcached (my usecase is OpenID -- which is 'heavy' on both).

Dw

Re: store_headers in memcache and diskcache

Posted by Colm MacCarthaigh <co...@allcosts.net>.
On Tue, Feb 05, 2008 at 01:49:43PM -0500, Garrett Rooney wrote:
> On Feb 5, 2008 1:45 PM, Dirk-Willem van Gulik <di...@webweaving.org> wrote:
> > Caching experts --  why do memcache and diskcache have seemingly quite
> > different caching strategies when it comes to storing the headers ?
> > E.g. the cache_object_t * is populated with the status/date/etc data
> > in memcache - but not in disk-cache. Is this work in progress or
> > subtle design ?
> >
> > I am trying to understand (got  a working mod_memcached_cache.c* --
> > and cannot quite get the right VARY behaviour).
> 
> If I had to guess I'd say it's because people have actually been
> working on disk cache, while mem cache has been largely ignored for a
> while.

Definitely! I remember the original patches tried to create some nice
abstractions so that more logic would move into mod_cache propery than
in mod_*_cache, but there turned out to be so many corner cases within
mod_disk_cache itself - and noone seems to /use/ mod_mem_cache - that
that fell by the wayside :/

-- 
Colm MacCárthaigh                        Public Key: colm+pgp@stdlib.net

Re: store_headers in memcache and diskcache

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On Feb 5, 2008 1:45 PM, Dirk-Willem van Gulik <di...@webweaving.org> wrote:
> Caching experts --  why do memcache and diskcache have seemingly quite
> different caching strategies when it comes to storing the headers ?
> E.g. the cache_object_t * is populated with the status/date/etc data
> in memcache - but not in disk-cache. Is this work in progress or
> subtle design ?
>
> I am trying to understand (got  a working mod_memcached_cache.c* --
> and cannot quite get the right VARY behaviour).

If I had to guess I'd say it's because people have actually been
working on disk cache, while mem cache has been largely ignored for a
while.

-garrett

Re: store_headers in memcache and diskcache

Posted by "Akins, Brian" <Br...@turner.com>.
On 2/6/08 1:35 PM, "Albert Lash" <al...@gmail.com> wrote:

> A little off topic, but would it make sense to use a ramfs with
> mod_disk_cache to get the best performance?

On linux, at least, just set cacheroot to something like /dev/shm/cache.
Same principle applies for other OS's as well.

-- 
Brian Akins
Chief Operations Engineer
Turner Digital Media Technologies


Re: store_headers in memcache and diskcache

Posted by Albert Lash <al...@gmail.com>.
A little off topic, but would it make sense to use a ramfs with
mod_disk_cache to get the best performance?

On Feb 5, 2008 5:24 PM, Ruediger Pluem <rp...@apache.org> wrote:
>
>
> On 02/05/2008 07:45 PM, Dirk-Willem van Gulik wrote:
> > Caching experts --  why do memcache and diskcache have seemingly quite
> > different caching strategies when it comes to storing the headers ? E.g.
> > the cache_object_t * is populated with the status/date/etc data in
> > memcache - but not in disk-cache. Is this work in progress or subtle
> > design ?
>
> But mod_mem_cache never restores the status (see comment mod_cache.c:288) :-).
> I think the difference is because cache_object_t is the data structure that
> mod_mem_cache actually stores in the cache to keep this data (in fact a pointer
> to the cache_info data) around whereas mod_disk_cache serializes the cache_info from cache_object_t
> data and writes it to disk. Once mod_disk_cache reads back the data from the disk it populates
> the cache_info field in cache_object_t again with the deserialized data
> (see open_entity and file_cache_recall_mydata).
>
> >
> > I am trying to understand (got  a working mod_memcached_cache.c* -- and
> > cannot quite get the right VARY behaviour).
>
> As others mentioned mod_mem_cache did not receive the same love as mod_disk_cache.
> So I am not quite sure if VARY even works correctly with mod_mem_cache.
>
> Regards
>
> Rüdiger
>
>



-- 
My Blogs:
http://www.docunext.com/
http://www.albertlash.com/

Re: store_headers in memcache and diskcache

Posted by Ruediger Pluem <rp...@apache.org>.

On 02/05/2008 07:45 PM, Dirk-Willem van Gulik wrote:
> Caching experts --  why do memcache and diskcache have seemingly quite
> different caching strategies when it comes to storing the headers ? E.g.
> the cache_object_t * is populated with the status/date/etc data in
> memcache - but not in disk-cache. Is this work in progress or subtle
> design ?

But mod_mem_cache never restores the status (see comment mod_cache.c:288) :-).
I think the difference is because cache_object_t is the data structure that
mod_mem_cache actually stores in the cache to keep this data (in fact a pointer
to the cache_info data) around whereas mod_disk_cache serializes the cache_info from cache_object_t
data and writes it to disk. Once mod_disk_cache reads back the data from the disk it populates
the cache_info field in cache_object_t again with the deserialized data
(see open_entity and file_cache_recall_mydata).

> 
> I am trying to understand (got  a working mod_memcached_cache.c* -- and
> cannot quite get the right VARY behaviour).

As others mentioned mod_mem_cache did not receive the same love as mod_disk_cache.
So I am not quite sure if VARY even works correctly with mod_mem_cache.

Regards

Rüdiger