Mailing List Archive

Cache replacement/eviction policy?
When all available cache space is used, and requests for new resources
arrive, does Varnish discard older objects to make space for new? Is its
policy for doing so configurable?

Thanks for any details/pointers,

- Gordon @ IA
Cache replacement/eviction policy? [ In reply to ]
Gordon Mohr wrote a while back (2007-09-20):
> When all available cache space is used, and requests for new resources
> arrive, does Varnish discard older objects to make space for new? Is its
> policy for doing so configurable?
>
> Thanks for any details/pointers,

Still wondering if anyone can comment on this question.

Once upon a time I would have assumed the answer was something like "of
course, that's what a cache does", but responses like this one from DES
back in May gave me pause:

http://projects.linpro.no/pipermail/varnish-dev/2007-May/000602.html

If I understand the implications of that thread correctly, at the time
of its writing, Varnish would crash rather than evict lesser-accessed
cached data.

In particular, I am considering using Varnish in front of a 'data set'
of > 1PB. Many (or most) of the URLs in the set will never be accessed,
but over the course of hours or days more will be accessed than can be
allocated the cache in RAM or disk. Still, we'd like to cache the 'hot'
items to ease the load on the backend and improve end-user responsiveness.

- Gordon @ IA
Cache replacement/eviction policy? [ In reply to ]
In message <4702D46E.4070805 at archive.org>, Gordon Mohr writes:
>Gordon Mohr wrote a while back (2007-09-20):
>> When all available cache space is used, and requests for new resources
>> arrive, does Varnish discard older objects to make space for new? Is its
>> policy for doing so configurable?
>>
>> Thanks for any details/pointers,
>
>Still wondering if anyone can comment on this question.

We have an experimental LRU (Least Recently Used) facility that
will do just that. For each candidate object, it will call the VCL
function vcl_discard() to ask if it is OK to ditch that object.

>Once upon a time I would have assumed the answer was something like "of
>course, that's what a cache does", but responses like this one from DES
>back in May gave me pause:

It's a quite new feature :-)

--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
Cache replacement/eviction policy? [ In reply to ]
Poul-Henning Kamp wrote:
> We have an experimental LRU (Least Recently Used) facility that
> will do just that. For each candidate object, it will call the VCL
> function vcl_discard() to ask if it is OK to ditch that object.

> It's a quite new feature :-)

Great, that's exactly what I was hoping for, even if it is in new/rough
form.

Is this only in trunk or also in 1.1.1? Thanks,

- Gordon @ IA