varnish Monitoring cached objects


Example

You monitor the cached objects to see how often they expire and if they are "nuked".

  • n_expired - Number of expired objects.
  • n_lru_nuked - Last recently used nuked objects. Number of objects nuked (removed) from the cache because of lack of space.
varnishstat -1 | grep "n_expired\|n_lru_nuked"
MAIN.n_expired              42220159          .   Number of expired objects
MAIN.n_lru_nuked              264005          .   Number of LRU nuked objects

The one to watch here is n_lru_nuked, if the rate is increasing (the rate, not only the number) your cache is pushing out objects faster and faster because of lack of space. You need to increase the cache size.

The n_expired is more up to your application. A longer time to live will decrease this number but on the other hand not renew the objects as often. Also the cache might require more size.