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.
To set up the full-page cache for your site:
- From the Admin sidebar, select Stores
- Under Settings, select Configuration
- In the panel under Advanced, choose System and expand the Full Page Cache section
- Select Built-in Application for your Caching Application
- Set the time-out for the page cache in TTL for Public Content (86400 is the default)
- 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.
Once you’ve chosen Varnish Caching:
- In Access List, enter the IP addresses that can purge the Varnish configuration, separating multiple entries with a comma. The default is “localhost”.
- In Backend Host, enter the IP address of the backend host that generates config files. The default is “localhost”.
- In Backend Port, enter the backend port that’s used to generate config files. The default is “8080”.
- 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).
- 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.