Caching in Magento: why Varnish does less than you think
Varnish makes Magento lightning fast, when a page comes from the cache. But far from every page comes from the cache. Where it goes wrong and what you can do about it.
Varnish is a cache that sits in front of your Magento shop. When a visitor lands on a page that has been built before, Varnish serves it straight from memory. Magento doesn’t have to do anything, and the page reaches the visitor within a few hundred milliseconds. If the page doesn’t come from the cache, Magento has to build it again. That often takes many times longer.
Varnish is switched on by default with most serious Magento hosting. That’s why many shops assume caching is taken care of. In practice, a larger share of pages does not come from the cache than you would think.
Varnish is only as fast as the share of your pages that actually comes out of it.
Where the cache is skipped
Marketing parameters. A visitor from an ad or newsletter arrives with parameters such as utm_source, gclid or fbclid in the URL. To Varnish that is a different page, unless those parameters are ignored. Your paid visitors in particular then get a slow page.
Imports that clear the cache. A stock or price import that runs every night or every hour can invalidate large parts of the cache. With a badly configured import, sometimes the entire cache is even flushed. The first visitors after that get slow pages, until the cache has been rebuilt.
Customer groups. Magento stores pages per customer group. If you have many customer groups with their own prices, as in a B2B shop, every group has its own version in the cache. The more groups, the smaller the chance that a page is already waiting.
Blocks that can’t be cached. A single block marked as non-cacheable, for example in an extension, makes the whole page non-cacheable. That’s a classic mistake that makes a shop a lot slower without anyone noticing.
What Varnish doesn’t solve
Varnish only speeds up how fast the server responds. What happens in the browser after that, Varnish doesn’t notice. A heavy frontend, too many scripts or an image that loads too late simply stay slow. The cart and the checkout never come from the cache either, so they have to be fast on their own.
How to see how well the cache works
Look at the server response time (TTFB) for real visitors. With a well-functioning cache you see two groups: many fast responses from the cache, and a smaller share of slow responses from Magento itself. If that second group is large, or contains many visitors from ads, there are gains to be made. On the server you can also track the percentage of pages that come from the cache.
What to take away
- Have Varnish ignore marketing parameters, so visitors from ads also get a fast page.
- Check what your imports do to the cache, and only refresh what has actually changed.
- Measure the server response time for real visitors, and look at which share doesn’t come from the cache.

