# Adobe Commerce and Magento full page cache vs Varnish vs Redis

By Oleg Snegov. Read time 11 minutes. Published Sunday, May 18, 2025.

**Tags:** Full Page Cache, Adobe Commerce, Magento, Mage-OS, Varnish, Valkey

---

Magento full page cache vs Varnish isn't really a contest, because Varnish is one of the two engines the full page cache can run on. The built-in engine keeps pages in a cache backend (the file system by default, or Redis or Valkey) and serves them from inside PHP, while Varnish keeps pages in its own memory and answers before the request reaches PHP, which is why Adobe recommends Varnish for production. Redis, which Valkey replaces on 2.4.9 and the newest patches, is a cache and session backend, so the short answer to "Magento 2 Redis vs Varnish" is that the production setup Adobe recommends runs both, for different jobs.

This applies to Adobe Commerce, Magento Open Source and Mage-OS, 2.4.4 through 2.4.9. On Adobe Commerce on cloud infrastructure, Fastly takes Varnish's place.

---

## What are the full page cache options in Adobe Commerce?

The full page cache has one setting that matters most, **Caching Application** (Stores > Settings > Configuration > Advanced > System > Full Page Cache), and four setups you'll meet in practice:

| Setup | Where cached pages live | What answers a cache hit | Adobe's view |
|---|---|---|---|
| Built-in, on the file system (the default) | `var/page_cache` on each web server | Commerce's PageCache plugin, in PHP | Not for production |
| Built-in, on Redis or Valkey | A Redis or Valkey database | Commerce's PageCache plugin, in PHP | Not for production |
| Varnish (on-premises) | Varnish's memory | Varnish, before PHP | Recommended for production |
| Fastly (Adobe Commerce on cloud infrastructure) | Fastly's network | Fastly, before your servers | Required in Cloud Staging and Production |

Adobe doesn't hedge on this. Its Varnish guide says "We strongly recommend you use Varnish in production" and calls the built-in caching "much slower than Varnish". Its performance best practices go further: "The PageCache module is still present in the codebase, but it should be used for development purposes only. It should not be used together with, or instead of, Varnish." Adobe's Admin reference describes the built-in option as "Not recommended for the production environment."

The reason is where the work happens. On a built-in hit, Commerce skips building the page, but the web server, PHP and the Commerce application still run for every request so the PageCache plugin can look the page up. On a Varnish hit, Varnish answers by itself and, in Adobe's words, the requests "do not reach the web server".

---

## Magento 2 Redis vs Varnish: which one is the full page cache?

Varnish, whenever you run it. Once **Caching Application** is set to Varnish, Commerce stops writing pages to its own page cache; Adobe's setup check is that `var/page_cache` stays empty. Redis, or Valkey, then does two other jobs:

- **The default cache:** configuration, layout, blocks, EAV and everything else `bin/magento cache:status` lists apart from the full page cache.
- **Sessions,** so a shopper's session lives in one place no matter which web server answers.

That's the split Adobe's performance guide recommends for sites with more than one server: Varnish, Redis for sessions, and "a separate Redis instance as your default cache (do not use this instance for page cache)". Its Redis setup guide suggests a dedicated instance each for sessions, the Commerce cache and the full page cache. It recommends persistence for sessions and says the cache instance doesn't need it, because the cache can be rebuilt.

Redis holds pages only when there's no Varnish. `--page-cache=redis` (or `--page-cache=valkey` on 2.4.9) moves the built-in cache off the file system, which helps when you run several web servers because they all see the same cached pages. Every hit is still a PHP request, though. It's a better built-in cache, not a replacement for Varnish.

The commands, with the database numbers Adobe recommends (0 for the default cache, 1 for the page cache, 2 for sessions):

```
# 2.4.8 and earlier: the redis flags, which also work against Valkey
bin/magento setup:config:set --cache-backend=redis --cache-backend-redis-server=127.0.0.1 --cache-backend-redis-db=0
bin/magento setup:config:set --session-save=redis --session-save-redis-host=127.0.0.1 --session-save-redis-db=2

# 2.4.9: Valkey has its own flags
bin/magento setup:config:set --cache-backend=valkey --cache-backend-valkey-server=127.0.0.1 --cache-backend-valkey-db=0
bin/magento setup:config:set --session-save=valkey --session-save-valkey-host=127.0.0.1 --session-save-valkey-db=2
```

---

## Does my version support Redis or Valkey?

Valkey is a fork of Redis, and Adobe has moved its cache requirement over to it. Adobe's Valkey guide says "Valkey is required for cache configuration for Adobe Commerce 2.4.9 and patch releases later than 2.4.5-p16, 2.4.6-p14, and 2.4.7-p9, and 2.4.8-p4", and the 2.4.9 release notes put it down to Redis 7.2 reaching end of support and Redis's licensing changes.

The system requirements for on-premises sites, as of November 2026:

| Release line | Redis | Valkey |
|---|---|---|
| 2.4.9 | Not listed | 9 |
| 2.4.8 | Not listed | 8; 8.1 at 2.4.8-p5 |
| 2.4.7 | 7.2 up to 2.4.7-p9; not supported at p10 | 8 from p6; 8.1 at p10 |
| 2.4.6 | 7.0, then 7.2 from p8 to p14; not supported at p15 | 8 from p11; 8.1 at p15 |
| 2.4.5 | 6.2, 7.0, then 7.2 from p10 to p16; not supported at p17 | 8 from p13; 8.1 at p17 |
| 2.4.4 | 6.2, 7.0, then 7.2 from p11 through p18 | Not listed |

On 2.4.8 and earlier, you point Commerce at Valkey with the same Redis flags. 2.4.9 adds the `valkey` flags shown above and a Symfony Cache backend you can select with `'backend' => 'valkey'` in `env.php`.

---

## How do I turn on Varnish as the full page cache?

The short version:

1. Install a Varnish version Adobe supports for your release, behind a TLS terminator such as nginx, with the Commerce web server moved to a backend port like 8080.
2. Set **Caching Application** to **Varnish Caching** in the Admin, or run `bin/magento config:set system/full_page_cache/caching_application 2`.
3. Generate the VCL with `bin/magento varnish:vcl:generate` (`--export-version=7` on 2.4.8 and 2.4.9, `6` before that), install it as `/etc/varnish/default.vcl` and restart Varnish.
4. Tell Commerce where to purge: `bin/magento setup:config:set --http-cache-hosts=127.0.0.1:80`.
5. Load a page twice and look for `X-Magento-Cache-Debug: HIT`.

---

## How much faster is Varnish than the built-in cache?

What Adobe does commit to: a page with cacheable blocks, served by Varnish, should load in under 150 ms. To measure your own site, time the first byte of a miss and then a hit on the same page:

```
for i in 1 2; do
  curl -s -o /dev/null -D - -w 'first byte: %{time_starttransfer}s\n' \
    https://shop.example.com/some-category.html | grep -i -E 'x-magento-cache-debug|first byte'
done
```

Run it on the same pages before and after you switch, at a quiet hour. The gap between `MISS` and `HIT` is what the cache saves on that page; the hit rate (`varnishstat -1 -f MAIN.cache_hit -f MAIN.cache_miss`) tells you how often you get it. On most sites the hit rate is the number worth working on.

---

## Why does every page come back as a MISS?

A cache is only as good as the share of requests it can answer. When pages keep missing, check these:

- **A block marked `cacheable="false"`.** If any block in a layout is uncacheable, the whole page is. One in `default.xml` turns caching off for every page on the site. From 2.4.7, Varnish labels these responses `X-Magento-Cache-Debug: UNCACHEABLE`. Find them with `grep -rn 'cacheable="false"' app/code app/design vendor --include=*.xml`.
- **Tracking parameters on every link.** Each new query string is a new cache entry. Every template strips `gclid`, `utm_*` and `fbclid`; the 2.4.8 VCL added `gad_source`, `srsltid`, `msclkid` and several more, and 2.4.9 also sorts query parameters. An old `default.vcl` can split one page into many copies.
- **Responses Varnish won't keep.** The Commerce VCL caches only 200 and 404 responses that aren't marked `Cache-Control: private`, and only GET and HEAD requests. URLs under `/customer` and `/checkout` always go to the backend.
- **Something on every page that skips the cache entirely.** On one distributor's Magento Open Source site, a production health check found an old admin shortcut making a second, uncacheable request on every product, category and cart page: about 25,000 needless requests in one 12-hour window, a quarter to almost half of the PHP work in it.

---

## Why does a page still show old content after a change?

Commerce invalidates by cache tags: each cached page carries the IDs of the products, categories and blocks on it, and a save purges only the pages tagged with what changed. When that goes wrong, it goes wrong in one of a few ways:

- **The purge never arrives.** No `http_cache_hosts`, a purge ACL that doesn't list the Commerce servers, or `cache:clean` run with a type other than `full_page` on 2.4.7 and later.
- **Varnish is serving stale on purpose.** After a page's TTL runs out, Varnish keeps serving the old copy for the grace period (300 seconds by default) while it fetches a new one. If the backend fails its health check, it serves stale copies for up to three days plus the TTL. On a hit, the Commerce VCL adds a `Grace` header: `normal (healthy server)` is the first case, and `unlimited (unhealthy server)` means your problem is the backend, not the cache.
- **The change hasn't been written yet.** Admin mass attribute updates are saved by a queue consumer (`product_action_attribute.update`). If consumers aren't running, the database still has the old value and there's nothing to purge.
- **Invalidation that's too broad.** The opposite failure: an integration that flushes the whole cache on every update keeps the cache permanently cold. Aim the purge at what changed. On one site, a stock update now clears only the bundle products whose stock status changed, not the whole cache.

---

## How do logged-in customers and carts work with a full page cache?

The page is cached once per context, not once per customer. Commerce keeps the context (store, currency, customer group) in the `X-Magento-Vary` cookie, and the Commerce VCL adds it to the cache key, so wholesale and retail groups each get their own cached copy.

Anything that belongs to one shopper, such as the cart, the wishlist or the customer's name, is what Adobe calls private content. The browser loads it after the page arrives, through customer data sections, and keeps it in browser storage. The server never caches it.

Edge Side Includes do a different job. When Varnish is the caching application, a layout block with a `ttl` attribute becomes an ESI include that Varnish refreshes on that block's own schedule. Varnish doesn't do ESI over HTTPS, so Commerce writes those include URLs as HTTP. ESI isn't how the cart works, and custom ESI rules in some older tutorials aren't needed.

---

## What changes on Adobe Commerce Cloud?

On Adobe Commerce on cloud infrastructure, Fastly is the full page cache in Staging and Production, and Adobe requires it there, including for PCI compliance. Integration environments don't have Fastly. **Caching Application** is set to **Fastly CDN**, the Fastly VCL is uploaded from the Admin, and custom behavior goes in Fastly VCL snippets.

Redis and Valkey run as Cloud services, and you configure them through deploy variables in `.magento.env.yaml`, not `setup:config:set`. Adobe's deploy variables reference says the `REDIS_BACKEND` variable isn't supported on 2.4.9 or on patches after 2.4.5-p16, 2.4.6-p14, 2.4.7-p9 and 2.4.8-p4; use `VALKEY_BACKEND` there. It also warns against copying on-premises `setup:config:set` options into `CACHE_CONFIGURATION`, because Cloud projects get connection details from their service relationships.

---

## Frequently asked questions

### Is Redis faster than Varnish for Magento?

They aren't racing. For whole pages, Varnish answers without PHP, while a Redis-backed built-in cache still runs PHP on every hit. For configuration, layout and sessions, Varnish isn't involved at all, and Redis or Valkey is the fast option, especially once you have more than one web server.

### Can I run Redis and Varnish together?

Yes, and that's Adobe's recommended production setup: Varnish for pages, Redis or Valkey for the default cache, and a separate instance for sessions. Don't point the page cache at the same instance as the default cache.

### Do I need Varnish on a small site?

Adobe's answer is yes for any production site. If your hosting can't run it yet, Adobe's guidance for a single web server is to keep the cache local: the file system on a RAM-backed volume, or a local Redis over a socket. Treat that as a stopgap and plan the move to Varnish.

### Should I move from Redis to Valkey?

If you're on 2.4.9, or on 2.4.7-p10, 2.4.6-p15 or 2.4.5-p17, yes: Adobe lists Redis as not supported there. On earlier patches, do it with your next upgrade. On 2.4.8 and earlier, Valkey takes the same configuration flags as Redis, so the switch is mostly a service change.

### What does TTL for public content do?

It's how long Varnish keeps a page before fetching it again: 86400 seconds, one day, by default. Product, category and price changes purge the pages they affect right away, so a long TTL doesn't mean stale prices as long as purging works.

### Does this work the same on Mage-OS?

Yes. Mage-OS 3.x and 4.0 are built on Magento Open Source 2.4.9 and list Valkey 8 as their cache, and Mage-OS 2.x is built on 2.4.8. Mage-OS recommends Varnish 7.7 for production.

Not sure what your site is really caching? Send us a URL and your version through Adobe Commerce support, and we'll tell you whether your pages come from Varnish, from PHP, or not from a cache at all, and why.