You may have already come across the acronym CDN for Content Delivery Network, but do you know exactly what it means? Increasingly, Magento sites improve their performance by acquiring a CDN. It also seemed appropriate to describe more precisely how it works. Explanation…

The problem with the response time of many media files

On your ecommerce site, you have dozens or even hundreds of files that are downloaded after retrieving the HTML code from the site generated by Magento. They typically have to do with images, CSS or JS files, which are also downloaded from the same server that hosts your Magento site.

Now imagine that your server is hosted in France but that one of your potential clients connects from Canada. Or, alternatively, imagine that your data are hosted in Paris but a visitor connects from Nice.

As you can imagine, crossing the Atlantic or even a country, will make your site a bit “slower” from the visitor’s perspective. Each file recovery can add tens of milliseconds, which add up for every downloaded media and end up counting in additional seconds!

The solution using a CDN

You can set up your website so that it uses a CDN. This means you will have to make a copy of your media files (usually the images on your site) in different datacenters, spread out all over the world, which will then directly send the requested files to users. For visitors, the data will load from the site closest to them hosting a copy of your files, which reduces distance and gives back better performance for your Magento site. The CDN principle works in the same way with other CMS such as WooCommerce, Prestashop or Hybris. With shorter travel back and forth between the user and the servers, the response time is reduced. This will significantly improve the score when downloading images!

Setting up a CDN can prove to be more or less complex without technical knowledge. Keep in mind that you do not need to use a CDN to host your entire site. Only static files that rarely or never change such as Javascript files, CSS style sheets and images should be placed on a CDN. Dynamically generated content with PHP scripts for example, should however remain hosted on the original server.

Using a CDN is an advanced optimization. It’s not a small change in code or a solution that you can easily achieve on your own if you do not have technical profiles in your company. Investing in a CDN depends on your priorities, goals, and also on your budget (using a CDN will generally require an additional hosting cost from a specialized provider, but given the speed impact, it will be profitable).

If you’re an online retailer, begin by asking your hosting partner if they have a CDN and if it may benefit you, otherwise your web agency or your hosting partner should be able to help you set it up.