How can CDNs affect web performance ?

Eroan Boyer

7 minutes

Un data center

A Content Delivery Network, often referred to by the acronym “CDN”, is designed to facilitate the distribution of web content. It is based on the use of servers installed in datacenters located in strategic points around the planet. These are connected to each other via private, high-speed fiber-optic connections, enabling web content to be accessed faster by Internet users.

The notion of CDN is therefore closely linked to that of page load speed. However, CDNs are not the answer to all web performance issues, nor are they a systematic solution to web performance challenges. In this article, we’ll take a look at what activating a CDN can bring in terms of performance and security, as well as the side-effects it can generate.

Advantages of using a CDN

State-of-the-art network technologies

Since CDNs are designed by network experts such as Akamai, Cloudflare, Amazon CloudFront and Fastly, they benefit from state-of-the-art, high-availability infrastructures. They are better equipped than 90% of traditional hosting providers. This means that they can take advantage of technologies that are not yet widely deployed, such as HTTP/3 protocol, Brotli compression as well as Early Hints.

It is possible to use these technologies on a conventional server, but at a much higher cost: this requires a high-performance virtual private server (VPS) or dedicated server. And you need to entrust management to an experienced system administrator, which also comes at a price.

Faster DNS resolutions

CDNs work like a Proxy, meaning they interface between the origin server (your hosting) and the end user (your visitor). To achieve this, they are entrusted with DNS management, usually handled by the registrar. However, CDNs have extremely high-performance DNS infrastructures, which translates into lower response times (Time To First Byte metric, TTFB).

Performance of Europe's leading DNS providers over January 2023
Performance of Europe’s leading DNS providers over January 2023. Source:

Cloudflare is exemplary in this field, boasting DNS resolution times 3 times faster than OVH, France’s leading web hosting provider. Incidentally, it’s perfectly possible to entrust DNS management to Cloudflare without activating the CDN functionality, and free of charge. You’ll then benefit from the very best in this area, with an appreciable impact on your TTFB.

Fast pages worldwide

This is the main use case for a CDN, and the one that only it can meet! Thanks to the ultra-fast network connections linking all its data centers, a CDN is capable of serving a page to any user in the world in a handful of seconds. If you’re hosting your site in France, and a significant proportion of your traffic comes from abroad, then the need for a CDN is definitely worth considering.

When choosing your CDN provider, make sure it operates datacenters in the regions in which your visitors are located. While Cloudflare, Akamai and AWS all have perfectly meshed infrastructures, other smaller providers only provide a few dozen locations. In this case, response times won’t be as good, as data will have to travel over long distances.

Optimized static content

One of the CDN’s basic mechanisms is to copy static files onto its own servers: the first time an image, video, stylesheet, font or JavaScript file is accessed, the resource is seamlessly cached on the fly… When a user accesses a website, the CDN automatically redirects requests to the closest datacenter to the user, considerably shortening loading times.

However, most CDNs offer the possibility of going even further, by applying on-the-fly compression, minification or even conversion of certain resource formats to other, lighter ones. The most common example is the generation of Webp or Avif images as an alternative to traditional PNG, Jpeg and Gif formats. This dramatically reduces their size while maintaining equivalent or slightly degraded image quality.

This second point can be managed directly by the hosting provider, but with the need to implement specific, often chargeable, tools. It can also impact disk space requirements: multiplying the volume occupied by images by 2 or 3 may require switching to a hosting package offering more disk space.

Lower hosting costs

By absorbing the majority of http requests, a CDN takes a great deal of strain off the origin server. Overall, the latter is only responsible for generating dynamic pages, while everything else is served directly by the closest datacenter to the visitor. This results in a significant reduction in both CPU and memory consumption.

On most sites, 95 to 99% of requests are handled directly by the CDN cache.
On most sites, 95 to 99% of requests are handled directly by the CDN cache. Source: Cloudflare dashboard screenshot

It’s up to you to keep this reserve of resources available, to absorb potential occasional peaks in traffic, for example. Or to downgrade your hosting to a lower-performance, and therefore less costly, offering. In the latter case, however, be careful not to underestimate the need: if the CDN cache is flushed, all subsequent requests will be routed to your hosting, which needs to be able to handle them.

Last but not least, don’t forget that CDNs are not free: to assess whether the solution will save you money, compare the cost of the initial hosting vs. the new hosting and CDN.

Enhanced security

Because CDNs function like proxies, they offer significant security benefits. For a start, your server is no longer directly exposed to end-users: they can’t identify its IP address. This makes it impossible for hackers to attempt FTP, SSH or Web intrusions without passing through the CDN provider’s firewall. Once again, CDN providers are at the cutting edge of what’s going on.

CDNs also feature advanced protection against Distributed Denial of Service (DDoS) attacks. They can switch instantly and transparently to an intelligent mitigation gateway. And, once the crisis has passed, they can resume normal operation without you even suspecting that the threat has been averted.

Drawbacks of using a CDN

High technical complexity for beginners

Deploying a CDN can be a complex task for web publishers accustomed to the all-in-one services offered by their web hosting provider, such as OVH, Ionos or Gandi. This involves changing the DNS servers, a step that is often intimidating for non-technical profiles. Next, check that the DNS fields have been re-entered in the new interface. Then you have to wait for DNS propagation to take place, which can sometimes take quite a while.

Once the DNS have been managed by the CDN, all that’s left to do is to configure the relevant options. By default, most additional optimizations are deactivated. So it’s up to the site’s publisher to set the optimal parameters… This is often not done. The result is a regrettable loss of performance potential.

A potential risk for the crawl

Gary Illyes, a well-known Google analyst, posted a message on LinkedIn explaining that one of the most common crawling problems involves the use of a poorly configured CDN and/or Firewall. The sometimes aggressive security settings of these tools can block search engine crawlers, preventing Googlebot, for example, from indexing a site’s pages.

The recommendation is to consistently check your CDN settings, and whitelist the IP address ranges used by known indexing robots. In the event of unfortunate blacklisting, the effects on SEO visibility can be devastating.

An “à la carte” business model that’s hard to anticipate

Most CDN providers offer a basic service, which mainly includes content distribution to the various datacenters, with a security overlay. Depending on the size and traffic of the site, this can already represent a significant cost compared to leasing a server from a web hosting provider.

Other advanced options, such as configuring firewall rules, enabling Brotli compression or generating Webp and Avif alternatives, may be subject to a charge. If you’re counting on a CDN to optimize your site’s performance, be sure to compare what the various players include in their standard offer, and make projections for variable-rate options: they often depend on the volume of bandwidth consumed.

Finally, before making any decisions, don’t forget to consider leasing a more powerful server, configured by an experienced system administrator: the cost will probably be significant here too, but the variability factor will disappear in favor of a fixed cost that’s easier to estimate.

An additional single point of failure

Although CDNs have very high availability infrastructures, they have all the technical characteristics of what’s known as a Single Point Of Failure (SPOF). More specifically, if your CDN encounters a problem or technical failure, your site will no longer be accessible or may be severely slowed down.

When a network failure hits a CDN provider like Cloudflare, panic ensues.
When a network failure hits a CDN provider like Cloudflare, panic ensues. Source: Cloudflare.

Such cases are rare, but have already affected players such as Cloudflare, which on June 21, 2022, for example, experienced a major network outage. Several hundred thousand sites around the world were unavailable for around 2 hours. Just long enough for network technicians to detect and correct the cause of the outage.

Unintended effect for localized audience

The main purpose of a CDN is to improve loading times for users located at a significant geographical distance from the origin server. If the majority of your users are located in the same geographical region as this server, the use of a CDN is probably not worthwhile.

Worse still, setting up a CDN will often have a negative impact on page response times if users are in close proximity to the origin server. Unlike static resources, dynamic pages cannot generally be stored in the CDN cache. Each time a request is made, the CDN fetches the page from its source, then offers it to the visitor.

This extra step can add tens or even hundreds of milliseconds to the TTFB, impacting other performance metrics such as First Contentful Paint (FCP) and Largest Contentful Paint (LCP). If you’re hosted in France and 95% of your visitors live in mainland France, a CDN isn’t the answer to your web performance problems.

So, cdn or not cdn?

When it comes to making decisions, it’s important to be pragmatic. If I had to sum up my opinion of CDNs in the light of the pros and cons outlined, here are a few key points:

  • This is an optimal solution for sites with worldwide traffic, but not for sites with a high degree of geolocation
  • It’s not the miracle answer to performance problems: you can also optimize your site on your existing hosting
  • This is an undeniable plus in terms of safety
  • It’s not necessarily cheaper than high-performance hosting

Feel free to share a comment to complete, qualify or question this article.

React to this article

You would like us to accompany you on your project?
Contact us now
You're interested in being accompanied by Agence Web Performance?