I'm try to improve Magento performances ( soon or later "MageDev" hit this point :)

I did some research and I found a lot of good, but not homogeneous, guides.

What I got is that:

  • MemCache or Redis are generic cache system, they cache data and they can be integrated directly with Magento (local.xml)
  • APC is a cache for the php code itself can only be integrated at server level.
  • Varnish is a reverse proxy, it cache the response can only be integrated at server level. ( there is a extension for Magento, turpentine, but I'm not sure what exactly does )

After all this good reading I'm still a bit confused about what of the above cache systems is possible to use in combinations, for EX:

  • MemCache + APC ?
  • Redis + APC ?
  • can I add Varnish to one of the above configuration ?

Just to be clear the question is not about how to configure Magento or the server but what are the possibility allowed and some clearance about how to mix cache systems. ( beside that if anyone can come with a good recommendation I would appreciate it thanks. )

  • Can you use FPC + Varnish + Turpentine together? thanks you Commented Mar 22, 2016 at 15:49
  • Turpentine is for hole-punching the Varnish cache. As in, turpentine is used to remove varnish. Commented Apr 23, 2019 at 1:48

2 Answers 2


TL; DR - On MageStack we use Varnish, Redis (cache), Redis (sessions) and Eaccelerator/Zend OPCache (depending on PHP version)

You've already got most of it understood.

The cache backend, session store, opcode cache, full page cached and reverse proxy cache are all completely different.

You can use different technologies for all and you can use them ALL simultaneously (including Varnish and a FPC)

Cache Backends

  • Files (Core) Default
  • Memcache (Core)
  • APC (Core)
  • Redis (<1.9 module courtesy Colin Mollenhour)
  • MongoDB (module courtesy Colin Mollenhour)
  • Rubic (module courtesy Daniel Sloof)

You can only use one cache backend.

Contrary to popular belief, using a memory based cache will not improve performance. But it will overcome some fatal flaws in Magento's default file based caching.

As of writing this message, Redis is my recommendation.

Session Stores

  • Files (Core) Default
  • Memcache (Core)
  • Redis (<1.9 module courtesy Colin Mollenhour)
  • MongoDB (module courtesy Colin Mollenhour)

You can only use one session store.

Contrary to popular belief, using a memory based session store will not improve performance.

As of writing this message, Redis is my recommendation.

OpCode Cache

  • APC
  • XCache
  • Eaccelerator (PHP <5.4)
  • Zend OPCache (PHP >5.4)

You can actually install multiple opcode caches, but it's not recommended, nor would I expect to see any gains.

My recommendations are in the brackets above.

No module is required to be installed to leverage this.

Reverse Proxy Cache

  • Varnish
  • Nginx
  • Apache
  • … and many more

You can use multiple reverse proxies, and whilst doing so is complex and prone to cache elongation, it can have merits (ie. To prevent stampeding during a cache flush).

Use one when necessary (ie. Not to speed up a slow site, but to reduce resource usage on a fast site).

To leverage a reverse proxy, it needs both enabling server side and needs a module for Magento.

The reason for the module is to help control caching logic (ie. To tell the cache what it should and shouldn't cache) and also to manage cache contents (ie. To trigger purges of the cache).

I don't recommend any unless you have a total understanding of what you are doing. Badly set up reverse proxies can break header information, can cause session loss, session sharing, stale content, apply additional limits to load time/buffers, consume additional resources etc.

Full Page Cache

  • EE FPC
  • … lots of others (via modules)

Use one when necessary (ie. Not to speed up a slow site, but to reduce resource usage on a fast site).

Contrary to popular belief, you can (and should) use a FPC in conjunction with a reverse proxy cache. The two solve different problems and have different capabilities.

FPCs can leverage more intelligence, because they have direct access to the users session and Magento's core, whereas a reverse proxy is not application aware (it's fairly dumb in the way it works) - so the two complement each other, not compete with each other.

Ie. Don't think Varnish or FPC, think Varnish and FPC.

  • 1
    Any clue about mod_pagespeed ? by the way great and clear answer thx
    – Fra
    Commented Dec 11, 2014 at 15:16
  • 2
    Plenty of recommendations. But the scope of PageSpeed is way beyond your original question (and largely unrelated to Magento itself). There's a few tips on our KB here, sonassihosting.com/help/magestack/… Commented Dec 11, 2014 at 18:02
  • Clear segregation between different layers of caching that can be used with Magento. Most importantly the recommendation. However, you don't seem to recommend using varnish cache in contrary to magento documentation recommendation refer - devdocs.magento.com/guides/v2.3/config-guide/varnish/… Commented Aug 27, 2019 at 13:10
  • @PandurangPatil You are aware that my answer was from 8 years ago - when Magento 2 didn't exist ... Hence my comments "At the time of writing". Had Magento 2 existed when this question was asked, my response would have been different. Commented Aug 28, 2019 at 14:04
  • @BenLessani-Sonassi I didn't pay attention to the date. Anyway, would you recommend using Varnish cache in today's context with magento 2.x? Commented Aug 30, 2019 at 12:47

I Would go for Redis + APC with Varnish on top.

'Why Redis' you ask? Read this excellent SO answer. Redis basically replaces Magento's standard file-based caching system. Since Redis is faster it'll give you some improvement on speed.

Varnish actually doesn't have that much to do with the inner workings. It's put on top and caches static content so it never actually reaches Magento as a request. Except for the hole punched parts that is.

While Varnish just focuses on frontend caching Redis will also speeds up the other types of cache like the EAV and Configuration caches.

Optionally you could check out some Full Page Cache extensions for Magento instead of Varnish. While it isn't as fast it's generally easier to implement and doesn't rely on extra software (like Varnish)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.