varnish Monitoring Varnish Cache performance

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!


Perhaps the most important performance metric is the hitrate.

Varnish routes it's incoming requests like this:

  • Hash, a cacheable request. This might be either hit or miss depending on the state of the cache.
  • Hitpass, a not cacheable request.

A hash with a miss and a hitpass will be fetched from the server backend and delivered. A hash with a hit will be delivered directly from the cache.

Metrics to monitor:

  • cache_hit - Number of hashes with a hit in the cache.
  • cache_miss - Number of hashes with a miss in the cache.
  • cache_hitpass - Number of hitpasses as above.
varnishstat -1 | grep "cache_hit \|cache_miss \|cache_hitpass"
MAIN.cache_hit              99032838         5.36 Cache hits
MAIN.cache_hitpass                 0         0.00 Cache hits for pass
MAIN.cache_miss             42484195         2.30 Cache misses

Calculate the actual hitrate like this:

cache_hit / (cache_hit + cache_miss)

In this example the hitrate is 0.7 or 70%. You want to keep this as high as possible. 70% is a decent number. You can improve hitrate by increasing memory and customizing your vcl. Also monitor big changes in your hitrate.

Got any varnish Question?