cachinggarbage-collectionvarnishttl

What happens when Varnish Cache is full?


I'm using varnish with -s malloc,1G"

It's currently 98% full. Once it completely full what will happen?

Will it purge?

Maybe purge old images/pages?

Or better yet purge the files with least amount of hits?


Solution

  • It looks like Varnish uses a LRU (least recently used) strategy to remove items from cache when the cache becomes full with things whose TTL (time to live) has not expired (so first remove things whose TTL is expired, if the cache is still full remove things least recently accessed).

    See

    https://www.varnish-cache.org/trac/wiki/ArchitectureLRU

    Note you can watch the n_lru_nuked counter to see the rate at which things are being flushed from the cache due to LRU.