Ignore:
Timestamp:
2007-06-25 18:04:09 (7 years ago)
Author:
Dag Erling Smørgrav <des@…>
Branches:
master, 1.1, 1.2, 3.0, 4.0, experimental-ims, tags/varnish-1.1, tags/varnish-1.1.1, tags/varnish-1.1.2
Children:
5e497ca
Parents:
9254972
git-author:
Dag Erling Smørgrav <des@…> (2007-06-25 18:04:09)
git-committer:
Dag Erling Smørgrav <des@…> (2007-06-25 18:04:09)
Message:

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:  http://www.varnish-cache.org/svn/trunk/varnish-cache@1570 d4fa192b-c00b-0410-8231-f00ffab90ce4

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bin/varnishd/cache_expire.c

    r11f984b r766469  
    7272        binheap_delete(exp_heap, o->heap_idx); 
    7373        binheap_insert(exp_heap, o); 
     74        UNLOCK(&exp_mtx); 
     75} 
     76 
     77void 
     78EXP_Retire(struct object *o) 
     79{ 
     80        LOCK(&exp_mtx); 
     81        TAILQ_INSERT_TAIL(&exp_deathrow, o, deathrow); 
     82        VSL_stats->n_deathrow++; 
    7483        UNLOCK(&exp_mtx); 
    7584} 
     
    175184 
    176185                if (sp->handling == VCL_RET_DISCARD) { 
    177                         LOCK(&exp_mtx); 
    178                         TAILQ_INSERT_TAIL(&exp_deathrow, o, deathrow); 
    179                         VSL_stats->n_deathrow++; 
    180                         UNLOCK(&exp_mtx); 
     186                        EXP_Retire(o); 
    181187                        continue; 
    182188                } 
Note: See TracChangeset for help on using the changeset viewer.