What is Magento Varnish Cache?
Short answer Varnish is an HTTP reverse proxy used for full-page caching. It can return an eligible shared response without asking Magento to build that page again. Configuration, request variation and invalidation determine what can be reused. Customer-specific information needs a private-content path; a fast cached page must not expose another visitor's data.
- Place the cache in the request path 01
- Use the configuration for your release 02
- Separate cache hits, misses and passes 03
- Keep invalidation connected to content 04
- Keep customer data out of shared HTML 05
Watch for this Adding an uncacheable block to every page
How Varnish fits the request and update path
A useful cache setup needs more than a running service. The request route, application headers, VCL and purge connection must agree.
-
01
Place the cache in the request path
Varnish sits between the incoming HTTP request and the origin web server. A matching reusable response can be served without rebuilding the page in Magento. TLS termination, the CDN and the origin topology affect this path, so start with the actual request flow rather than copying a port diagram from another store.
-
02
Use the configuration for your release
Magento provides Varnish configuration tooling and VCL templates. Choose versions supported by your exact Commerce release, review the generated configuration and test it before activation. The Adobe configuration guide covers the application setting, backend and purge access list.
-
03
Separate cache hits, misses and passes
A hit uses stored content. A miss needs a response from the origin before it can be stored. A pass sends the request through without treating it as a normal shared cache candidate. A working cache can therefore still send substantial traffic to PHP. Inspect the actual request and response before diagnosing a low hit rate.
-
04
Keep invalidation connected to content
Magento uses cache identities to describe which content a response depends on. The purge connection and its allowed sources must work so changes can invalidate affected entries. Test an ordinary product or CMS edit through the approved staging workflow, then inspect the public response rather than relying only on a successful Admin save.
-
05
Keep customer data out of shared HTML
The standard storefront uses customer sections to load private data such as cart information in the browser. ESI is a separate mechanism for eligible blocks with their own lifetime. It is not the general explanation for the mini-cart. See Adobe's private-content guidance before customizing either path.
When to examine a shared page cache
Use measurements from actual requests to decide which work belongs in Varnish and which remains in the application or browser.
-
Public pages need reusable responses
Category, product and CMS pages often contain substantial shared content. Varnish can reduce repeated origin rendering when those responses are eligible. Review custom blocks, request variation and invalidation together; a cache cannot reuse a page that the application correctly marks private or uncacheable.
-
Origin capacity is a constraint
A shared cache can reduce repeated PHP work, but it does not remove uncached checkout, customer or search costs. Measure hits, passes and origin timings before choosing capacity changes. Do not use an infrastructure upgrade to hide a broken invalidation or cache-eligibility rule.
-
Several cache layers need clear ownership
A CDN, Varnish and the application may all participate in delivery. Decide where content is stored, how requests vary and how each layer is purged. The correct setup depends on the hosting platform; Adobe Commerce cloud projects use the platform's supported Fastly configuration.
-
A deployment needs a cache acceptance check
After a reviewed change, check a public miss and hit, an intentional private response and a content update. Inspect a second anonymous session as well as the first. Record the result for that environment instead of treating one fast reload as proof that caching is safe.
Cache changes that need careful review
Correct content and safe variation come before a hit-rate target. These mistakes can reduce reuse or serve the wrong response.
-
Adding an uncacheable block to every page
In Magento's layout system, an active block declared
cacheable="false"makes the containing page uncacheable. Placing it in a common layout can affect many routes. Keep genuinely private data private, and use the documented customer-section pattern where appropriate rather than forcing public caching. -
Changing VCL without testing purges and variation
A VCL edit can affect which requests share responses and who can invalidate them. Review cookie, store and other relevant variation rules together with the purge ACL. Never make customer or account responses public merely to increase a hit-rate number.
-
Treating a stale mini-cart as an ESI-only problem
The normal mini-cart depends on browser customer-section data. Check the section request, invalidation actions, frontend errors and any intermediary cache before changing VCL. A custom theme may have another implementation, so confirm its actual source rather than applying a generic hole-punching recipe.
Magento Varnish Cache: frequently asked questions
-
What does Varnish cache in Magento?
Varnish stores eligible shared HTTP responses according to the deployed VCL and application headers. Public product, category and CMS responses are common candidates. A cart or account page needs different treatment. Whether a particular response is stored must be checked on the actual installation. -
How is Varnish different from Redis?
Varnish is an HTTP reverse proxy. Redis can serve application-cache, session or built-in page-cache roles where supported and configured. They are not interchangeable settings. Check the supported services for your release and the role of each configured backend; this cache glossary entry explains the distinction. -
Does the mini-cart use ESI?
The standard Magento storefront loads private cart data through customer sections in the browser. ESI is a separate path used for eligible blocks with a lifetime. A custom storefront can work differently, so inspect its implementation. Do not mark the whole page uncacheable simply to refresh the mini-cart. -
Why does a page miss the Varnish cache?
A first request can be a normal miss. Other causes include request variation, expiry, invalidation, a pass rule or an uncacheable application response. Inspect the response and deployed VCL together. A single activecacheable="false"layout block can make the entire containing page uncacheable. -
How much faster will Varnish make my store?
There is no fixed multiplier or response-time guarantee. A reusable hit can avoid origin page generation, but misses, private requests and frontend work remain. Compare representative traffic, cache states and user flows before and after a change, rather than promising a score from the presence of a service. -
How should I check a Varnish change?
On staging, verify public hit/miss behavior, intentional private responses, store or customer variation and a normal content update. Check that purge permissions are restricted and effective. Use the current Adobe setup guide alongside the generated VCL for your release.
Need help investigating cache behavior?
Share the store version, hosting arrangement and a reproducible stale or slow response. The performance service page explains how to define an investigation.