Reflection on Magento and Caching
Caching is a software or hardware component that stores data so future requests for that same data can be served faster. Caching is vital to speed up computing, and saves resources and time used to access data. Caching is implemented in most layers of a web server software stack, in the file system, database, the web server and web applications.
A common perception is that alternative caching backends and full page caching will solve store performance problems. This is rarely true.
From experience, we know that Magento developers start asking for a faster caching backends like REDIS and a full page cache solutions like Varnish when challenged with performance problems. The general expectation is that installing and configuring this will solve the performance issues – it won’t!
Magento E-commerce and Full Page Caching
This test demonstrates that full page caching usually does not deliver the results developers are looking for to achieve. And here is why;
- The Full Page Cache only caches recently accessed pages
Most stores have many hundred, or often thousands, of different pages. Full page caches usually do not cache everything, and cache items are frequently expired.
- Site visitors access random pages
Okay, they usually come by the front page – but the pages a customer vists are in general a random selection. For a full page cache to be effective, the pages need to be ready in the cache when asked for, and if they are not – full page caching is not helping on performance.
- Magento admins clear caches, all the time
Full Page Caching is contradicting the ordinary day-to-day work flow for Store Owners and Admins.
- Integrations force cache refreshes, all the time
Many stores synchronise their products from other sources, and to get changes online – caches are cleared continuously.
- Full Page Caching does never apply to backend performance
Order lists, order management, product management, category management and all other day-to-day tasks in the backend will remain slow and uncached.
Given all these factors, what performance gains can one really expect to get by implementing full page caching? When would the cache work? The answer is that full page caching gives performance improvements only for very frequently accessed pages, and when experiencing traffic spikes.
The test results suggest that the performance gains for the day-to-day performance are very small, and that full page caching primarily is a tool for scaling.
Alternative Caching Backends – REDIS & MemCached
It is also common to switch out the default file or database cache backend, with REDIS or MemCached. Both of these are excellent applications, but will usually not make much of a difference on performance for the users of the website.
The reason for this is that alternative caching backends only provide faster read and write access to the cache.
The most common problem in Magento is not cache read or write access, but the actual creation of cache elements – which is done in MySQL and PHP. An alternative caching backend will not speed up the time it takes to make cache elements, it will only provide a faster way to save and read data from the cache.
Also, the I/O performance gains from memory based cache backends are generally overstated for Magento. If you have a correctly configured software stack, running on SSD hard drives with enough RAM, the elements will be cached in the file access system – or in RAM anyway.