Improve Varnish Cache Hit Rate

The Varnish Cache project provides some high level instructions on improving cache hit rate.

The following describes the work flow with metrics and development processes to achieve optimal cache hit ratios.

  1. Review Varnish metrics
  2. Review http logs
  3. Make changes to VCL locally
  4. Confirm change has been effective -> Logs
  5. Promote changes to Production
  6. Confirm change has been effective -> Metrics
  7. Rinse and repeat

Review Varnish Metrics

Your Varnish metrics provide an overview of cache hit ratios for all asset types in addition to cache hit ratios by type.

You can use these metrics to identify an object type for which you would like the cache hit ratio to be improved.

Review HTTP Logs

Use the Kibana logs to review the HTTP requests. For more information about these logs please check out the docs here.

Make Changes to VCL

Modify your local VCL file. Save and fire the requests at your local instance. See Local Development.

Review logs again to confirm a change in the cache hit behavior for the target assets.

Promote Changes to Production

If required you can test the application locally to confirm the VCL changes have not affected the functionality of the application adversely for users.

Sync your repo with production and confirm cache hit rates are improving by reviewing your metrics.

Rinse and Repeat

Until you hit a desirable cache hit rate across the site.