4 Magento cache systems to speed up your Ecommerce

By

Searching for new optimizations in order to improve the speed of your Magento-based website and boost your conversion ? You may want to start thinking about using caches. But first, what is a cache ?

A cache is a technology used to save pre-generated documents and datas that are likely to be reused later on by a server, in order to avoid it to do unnecessary overwork.

That may sounds too vague for you. Imagine then a librarian who stocks the Lord of the Rings books in shelves far away from his cash register. A customer enters the shop and wants to buy the trilogy. The librarian goes for it, but he sees other customers coming in and looking for the same books. Tired of crossing the store and wishing to gain time, he puts all of the LoTR books on the same shelf near his cash register.

Now replace the librarian by the server, and the shelves being first the hard drive, and then the cache. This is the main idea of a cache : gaining time by storing datas you want to reuse if a similar request occurs.

gatekeeper2

For instance, when using a cache, a server is able to display a website page almost immediately if another user has already visited the same page. This usually leads to dramatically faster processes. Interesting, isn’t it ? Then, let’s have a look at it.

First and foremost, you must know many different caches exist to speed up a Magento application.Here are four key caches that can lead you to gain better performance.

1. Varnish, the Magento gatekeeper

Varnish is a very powerful asset when aiming at speed optimization for Magento. Indeed, it is a cache server who plays the role of a mediator between the users and your server (known as ‘reverse proxy’).

schema_cache_1

schema_cache_12

It allows you to store static HTML pages (when one do not grant interactivity with the users) that have already been loaded previously. It prevents Magento, and so the server, from running at all !

The benefits are really important : just imagine a customer who goes through a catalogue, clicks on several pages, and then wants to go back to a previous page to perform an impulse purchase. He will experience a very smooth user experience, thus being more likely to go through the whole sales funnel. He may even be willing to come back on your website next time he shops online.

Varnish is licensed under BSD, and therefore is free to use for your applications.

The only issue you could experiment while using it is whether you should cache a particular item or not, depending on its reusability. To use it in an optimum way, developers have to spend time installing it and configuring it correctly. However, it appears really worth it at the end of the day, since you will end up with one of the best performance-improver tool on the market.

2. Magento Full Page Cache for faster websites display

Along the same lines, Full Page Cache grants you basically the same functionalities as Varnish. However, FPC is a module already included in Magento Enterprise Edition and Magento 2.0, which can spare you the task of installing it. Moreover, it can be really useful for high-traffic Magento websites using average servers, as FPC can cope with peak loads pretty well. Very effective, it can boost the speed of your webpages by 6 to 25 times.

This extension also allows you to configure easily which pages you want to exclude from the cache compared to Varnish.

3. Avoiding reloading some piece of code with BlockCache

Now is time to work inside the Magento system so as to get rid of your slow pages. We have already seen that it is possible to store reusable static HTML pages, but what if they content real-time display that has to be modified depending on the user logged ?

That is the purpose of BlockCache. BlockCache is the default cache system implemented in Magento. You should better use it since it is able to store some selected pieces of an HTML code (known as ‘blocks’) you want to reuse on another page. This tool prevents Magento generating the same blocks over and over, which will result in your app being considerably faster for a logged user. It is really simple to use and won’t take long to be up and running.

4. Magento still too slow ? Opcode Cache, the icing on the cake

Until now, we focused on how to optimize HTTP requests on static pages and Magento itself. However, there is one step left before totally speeding up your website. Yes, we didn’t talk about the engine (PHP!) yet.

Magento is a framework based upon PHP programming language. The particularity of a code written in PHP is that every instruction has to be compiled before a web server can execute it, in an intermediate language named “Opcode”. However, numerous requests your PHP code addresses to your server are eventually identical, thus forcing it to repeat the same process over and over. Doing so is time and energy consuming. The idea behind Opcode Cache is to save those compiled versions of the code in a cache in order to execute them without the need to compile it every time, meaning much faster.

Don’t underestimate its benefits. On average, you can save up to 30% of the execution time. Moreover, it allows your server to handle more requests at the same time, which means more users can visit your website without it crashing. Using an Opcode Cache is an easy and key work if you are eager to make your Magento faster and lighter.

And last but not least, third party solutions

CDNs, reverse-proxies and others PHP accelerators can help you save some precious hundreds of milliseconds.

To name some great solutions :

  • Fasterize acts as a reverse-proxy outside of your architecture and, like Varnish, can make sure that your Magento almost never get to run for pages that are most viewed by your visitors.
  • Litespeed is a software to be installed on your server. It replaces apache with a webserver with a built in cache.  Unlike reverse proxy solutions such as Nginx and Varnish, it handles everything in one single solution.
  • NitroGento is a Magento extension that allows you to use a Full Page Cache system even on Magento Community edition, and many other additional cache features.

Monitoring your speed is key

Now, you have all the keys in hand to boost your speed and gain tens of conversion percentage for your Magento store.

Nevertheless, it would be reckless to rely only on the caches you just put in place in case of slowdowns and wait until your dev team finds out. You must keep in mind that speed equals conversion. In order to keep your customers on your website and never lose a sale, monitoring your speed with appropriate tools is key.

Getting a simple alarm system monitoring your server is not enough since it won’t warn you about slowdowns, but only about an overheat of your server or cut downs.

Tags

Magento, Performance