Varnish is the fastest way to serve Magento pages. Its value depends on the hit rate, the share of requests answered from cache without touching PHP. A low hit rate means much more load on your server and slower pages at busy times.

Measure the hit rate

varnishstat -1 | grep -E 'MAIN.cache_hit |MAIN.cache_miss '

Hit rate = hits divided by (hits + misses). For a mostly anonymous store, 80–90% or more is a good target. Stores with many logged-in customers run lower.

The usual causes

  • Campaign parameters in URLs: ?utm_source=..., gclid or fbclid make every ad click look like a different page to Varnish.
  • Marketing cookies: analytics and pixel cookies (_ga, _gid, _fbp, _clck) can stop caching if the VCL does not ignore them.
  • Uncacheable pages: a block marked cacheable="false" makes whole pages uncacheable (see full page cache not working).
  • A short cache lifetime or frequent full cache flushes.

How to fix it

In your VCL’s vcl_recv, remove campaign parameters before the cache lookup and ignore marketing cookies. Magento’s generated VCL already handles some parameters. Extend the list with the ones your marketing uses, then reload Varnish and watch the hit rate recover as the cache refills.

Avoid flushing the whole cache after every small change. Magento clears only the affected pages when products or CMS content change.

Check the cache is big enough

varnishstat -1 | grep n_lru_nuked

A steadily rising number means Varnish is throwing away cached pages to make room. Give it more memory with the -s malloc size in its service settings.

Catch it automatically

MageMonitor checks for this every few minutes as part of its Cache Health checks, and alerts you by email, Slack or webhook the moment it appears, with the exact commands to fix it. See MageMonitor for Magento 2.

Related fixes