Mage-r Surgery: Magento’s cache and optimising your server environment

There have been many blog posts written about Magento's cache; but many have been written by developers for developers. We however understand how confusing these can be as a retailer who simply wants the best performance, that's why we thought we'd try help to explain the different caching options available for your Magento store. So if you're a retailer whose core focus is cash and not cache, keep reading.

Magento's default

Magento by default uses a two level cache backend framework; these entries are stored in the database/file system (var/cache). This cache backend is fine for small websites, but if your business is growing and your website getting more and more visitor requests; writing these files to the system can get slower and slower as the cache continues to grow.

Magento works by clearing cache entries by tag e.g. after placing an order or saving a product to make sure the block caches are updated on the storefront. During this process, Magento has to open each file to check if the entry belongs to the cache group.

Basically, if you have a Magento shop with >= 1000 products you will have a cache size of approximately 50 MB. A 50 MB file system cache has about 3500 entries (files) - you can imagine how slow this can be!

One of the main benefits of not using Magento's default cache is that you can use different technologies simultaneously for optimal performance. When your developer configures your server, you'll have the options of many different cache backends; all of which have their own features.

APC (key/value)

Instead of using Magento's default file caching, many developers recommend using an APC – Alternative PHP Cache. APC is a free, open opcode cache for PHP which provides an open and robust framework for caching and optimising intermediate PHP code.

NB: You're Magento store is built on a PHP framework.

If you opt for APC caching you need to be aware that it does not support tagging, this means that you'll still have a slow file system cache. APC does however have a very fast cache backend that once installed on your sever, duplicates PHP script executions optimised to run more effectively. APC also provides a user cache for application data.

MemCache (key/value)

MemCache is memory object caching system that speeds up dynamic web applications such as Magento to alleviate database loading. Much like APC, it is a very fast, high performance cache backend which doesn't support tagging.

MemCache should not be ruled out because of this. Magento's two level cache enables you to integrate two technologies for the best performance.

Redis (advanced key/value)

We've saved one of the best till last. Redis is an advanced key-value store with full cache tag support. This cache works by allowing you to use a Redis server as central storage and it supports cache tags for an optimised file system cache as well.

Redis is also a huge boon to enterprise retailers hosting on a multi-server environment where you have more than one web server. The fast cache backend with full cache support has been tested on high traffic Magento stores with more than 500,000 visitors a day; delivering excellent performance and a stable environment.

Magento cache recommendations

Still not sure what's best for your store? If you have a small store with a therefore small Magento cache; APC plus a second level file system cache would work fine. This will ensure optimised delivery of PHP as well as better file system caching.

If you're a larger SMB on a dedicated server or with large volumes of traffic hitting your store we would always recommend a server level cache like Redis. Extremely fast and ideal for big caches over 500MB, Redis will also support a multi-server environment where you need a central cache.

Have questions about your hosting or want to improve site performance? Why not talk to one of our friendly team members today. Call 01183 805 705.

Catherine Durham

Catherine Durham

Marketing Director (Dip DigM)

Catherine Durham has a masters in Digital Marketing and a wealth of experience in optimisation and strategy development for ecommerce retailers. Her specialisms include SEO, paid search, email marketing and conversion rate optimisation.

Comments and feedback

Have something to add? Join the discussion and let us know your thoughts via the comments.

Add a comment