As you probably know, a CDN (Content Delivery Network) is a network of servers dynamically storing static data from websites. Well, that's still basically the theory.
For many users, the choice to use a CDN is dictated by the performance of their website based on advice from online performance analysis services or SEO (Search Engine Optimization) analysis.
They simply follow what is recommended without understanding how it works or why it is necessary.
So let's really recall what a CDN does.
What is a CDN
The functioning of a CDN is quite simple. It is a cluster of servers spread around the globe in order to replicate the static data of websites.
Basically, when you save a file on your hosting server linked to this CDN, it is replicated in real time on all the clusters around the world without you having to do anything and almost instantly, with complete transparency.
Real benefit of a CDN
When you use a CDN, you make your files available as close as possible to your website's visitors, allowing it to display your pages more quickly.
That's the theory anyway, but really, do you think it's always necessary to invest in a CDN to have a fast site?
In reality, the CDN is especially one of the last elements of optimization of a site, but as it is one of the simplest to implement, it is privileged by many, thus masking more complex optimizations but much more important to really correct the concerns of slowness observed on certain Internet sites.
When to use a CDN?
Let's take the case of an ecommerce website developed with PrestaShop and hosted in France. If this site offers its products internationally with a site translated into English or Spanish, we can suspect that the site's audience can be located anywhere in the world. So, it seems coherent to use this kind of service to bring the data as close as possible to the visitor and avoid him waiting for the file to cross oceans or entire continents (even if this is not completely true since each ISP has its own global caches, but let's not push the complexity of this kind of thing too far).
A second interesting case, but which should not exist, is that of a site hosted in another country than the one of its audience. I know it sounds absurd, but it is very often the case. We often find completely French sites hosted in the United States. Don't ask me how this can happen, but it does, so let's talk about it. In this case, the use of a CDN is just there to compensate for the initial design error of the project, whether for an institutional site developed with Joomla or wordpress, or an eCommerce site deployed with PrestaShop or Woocommerce.
When I should not use a CDN
Basically, all the other cases :-)
- believe that the use of a CDN will reduce the server load and avoid abandoning its shared hosting at low cost.
- that it will compensate for the lack of optimization of the source files.
- that it will accelerate a site hosted in a country whose audience is mostly in the same country.
- believe that a CDN is required, especially if you don't know what it is and what it can be used for.
Summarizing briefly, we can say that the use of a CDN is justified only when the site becomes big and its audience is very international. Nothing else.
So, really ask yourself how much of a bonus the use of a CDN will bring to your site and especially if you are making this choice for the right reasons which are very very very limited.