]> err.no Git - varnish/commit
First step in implementing early retirement of objects when the cache fills
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 25 Jun 2007 17:04:09 +0000 (17:04 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Mon, 25 Jun 2007 17:04:09 +0000 (17:04 +0000)
commit3277446cce0e7e83d3c1a9cc3aa9a679f336a89d
tree72f7636d6202e83f4add1a962e31225e65629e0a
parentbacbb9f96f6eecdd349e0e67e585d316647fc098
First step in implementing early retirement of objects when the cache fills
up: implement a "sloppy" LRU list.  An object is placed on the list (or moved
to the head of the list if it's already on it and hasn't moved recently) by
calling LRU_Enter(), and removed by calling LRU_Remove().  LRU_DiscardSpace()
will iterate through the LRU list, starting at the back, and retire objects
(by adding them to the deathrow list) until the sum of the length of the
retired objects reaches a certain number.  Similarly, LRU_DiscardTime() will
retire objects which haven't moved since a specified cutoff date.  In both
cases, vcl_discard() will be given a chance to inspect the object and veto
its retirement.

Currently, LRU_Enter() and LRU_Remove() are called from HSH_Lookup() and
HSH_Deref() respectively.  There may be better alternatives.

Neither LRU_DiscardSpace() nor LRU_DiscardTime() is currently called from
anywhere.  There are a number of issues to consider: for instance, even if
LRU_DiscardSpace() is called when a high-water mark is reached, there is
still a possibility that the cache might fill up before it has had a chance
to finish and the hangman has had a chance to process the deathrow list.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1570 d4fa192b-c00b-0410-8231-f00ffab90ce4
varnish-cache/bin/varnishd/Makefile.am
varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_expire.c
varnish-cache/bin/varnishd/cache_hash.c
varnish-cache/bin/varnishd/cache_lru.c [new file with mode: 0644]