Making Magento faster with caching | Heart Internet Blog – Focusing on all aspects of the web

Think about the last time you dealt with a slow-loading website. What did you do? You probably hit the back button and never thought about returning to it.

When your visitors look at your website, configuration files are located and read to start displaying the right block of information on the page. Each time this happens, another chunk of processing power gets used up. And as resources and performance get squeezed, the loading time of your site slows down considerably.

With speed being an important factor in how your visitors experience your website, as well as how search engines rank websites, the greater the load time, the worse off your site will be. And it’s not just lower rankings in search engines, it could affect sales.

Add in the HTTP cache

Adding in client-side caching speeds things up, with the client’s browser storing the requested files and reusing them as needed. Every time a visitor calls up a page with content that has changed, the new content is retrieved from the server while the same content stays in place.

All browsers are shipped with their own built-in HTTP cache – it’s just a matter of you setting up the right HTTP header instructions to ensure that caching is used, which you can find on Google’s Web Fundamentals page on HTTP Caching.

Built-in full-page caching

Full-page caching lets us fetch the required files and save the output on the server to be reused over and over, dramatically improving performance. And Magento Community Edition offers full-page caching.

Magento’s built-in full-page caching provides an easy way to improve the loading speeds, and talks you through the process as you go, especially when you’ve updated something and need to refresh the cache.

Screenshot of Magento's built-in caching system

To set up the full-page cache for your site:

  1. From the Admin sidebar, select Stores
  2. Under Settings, select Configuration
  3. In the panel under Advanced, choose System and expand the Full Page Cache section
  4. Select Built-in Application for your Caching Application
  5. Set the time-out for the page cache in TTL for Public Content (86400 is the default)
  6. Click Save Config

Use Varnish for even faster results

While the built-in caching is nice to have, it can be a bit slow for your production environment. That’s why Varnish Cache is great to install as well. Varnish is designed to work just with HTTP, making websites load faster.

Magento’s written up exactly how to set up and install Varnish on your server and use it with Magento in its Configuration Guide.

Once you have it installed, you can set it up through the same Full Page Cache section you use above. But instead of selecting Built-in Application, choose Varnish Caching.

Screenshot of the Magento admin panel for Varnish

Once you’ve chosen Varnish Caching:

  1. In Access List, enter the IP addresses that can purge the Varnish configuration, separating multiple entries with a comma. The default is “localhost”.
  2. In Backend Host, enter the IP address of the backend host that generates config files. The default is “localhost”.
  3. In Backend Port, enter the backend port that’s used to generate config files. The default is “8080”.
  4. Export the configuration as a varnish.vcl file for the version of Varnish you’ve installed (either Export VCL for Varnish 3 or Export VCL for Varnish 4).
  5. Click Save Config

Or try a CDN

Magento also provides you with the option of storing the media files within a Content Delivery Network (CDN) rather than on a web server’s file system.

This does minimise the resources needed to synchronise media, especially across multiple instances deployed on separate servers. However, you will need to choose and configure the CDN yourself, and then configure it through Magento.

You can read more on this in Magento’s documentation.

 

Magento is a powerful e-commerce solution that works best on VPS and Dedicated Servers. And with a little bit of work, you can have your Magento shop returning record-fast speeds for even more sales.

Comments

Please remember that all comments are moderated and any links you paste in your comment will remain as plain text. If your comment looks like spam it will be deleted. We're looking forward to answering your questions and hearing your comments and opinions!

Got a question? Explore our Support Database. Start a live chat*.
Or log in to raise a ticket for support.
*Please note: you will need to accept cookies to see and use our live chat service