Did you fail the ‘Use a Content Delivery Network (CDN)’ audit?
We’ll explain how using a Content Delivery Network (CDN) affects your GTmetrix Grade and how they help your page perform faster.
How does your website do on our CDN audit?
Content Delivery Networks (CDN) are a great way to ensure your page performs quick globally.
If you are unfamiliar with CDNs, have a look at our Why use a Content Delivery Network (CDN)? article to learn about how they work.
In this article, we’ll discuss in detail how CDNs affect your GTmetrix Grade and why. We’ll also define how CDNs generally work and how they help in improving performance for your visitors worldwide.
How do CDNs work?
CDNs store your page’s commonly accessed resources in Edge Servers all around the world.
Most CDNs work as follows; When a user requests your site, the CDN’s Edge Server closest in proximity to the user will deliver the static resource, ensuring the shortest distance for the data to travel; thereby, reducing latency.
This provides the user with a faster site experience over fetching the file from your own server (i.e., the Origin Server).
CDNs also help by reducing the stress on your Origin Server by fulfilling requests on its behalf.
Instead of your Origin Server handling all the requests from your visitors, the job is now distributed across multiple Edge Servers.
More advanced CDNs can not only cache your static resources, but your entire web application.
For example, Cloudflare caches your entire site (anything pointed to your domain) and hides your Origin Server completely (this is how they protect you from DDoS attacks as well).
Read our full article here: Why use a Content Delivery Network (CDN)? .
General CDN Terminology
If you’re already experienced with CDNs, feel free to skip this section. If CDNs are new to you, however, there are a few important terms and concepts you should understand.
Origin and Edge Servers
The server at which your website is actually hosted. This is wherever your hosting service has its data center.
One of the many servers in the CDN’s global network. Your geographic location determines which edge server delivers resources to you.
This means the resource was served from the Edge Server’s cache.
You want as many cache hits as possible – meaning the CDN is serving the requests and not your Origin Server.
This means the resource was not served from the Edge Server’s cache, and the resource was instead requested and delivered from your Origin Server.
You want as few cache misses as possible – high cache miss rate means your resources are not being reliably delivered by the CDN.
This means a request for a resource was made, and the CDN had it cached, but it also performed a check with the Origin Server to see if the cached resource was still valid (i.e. hasn’t changed, still correct to serve, etc.).
A failed revalidation is essentially treated as a Cache Miss.
Time to Live (TTL)
The amount of time to consider a cached request valid on the Edge Server. After this time elapses, requests typically go through revalidation (see above).
CDNs typically allow adjustments of TTL to ensure frequently updated sites always deliver the latest resources.
The duration of when the request was started, and a response was given.
The further a visitor is away geographically from a server, the more latency is present.
The fundamental goal of CDNs is to reduce latency by providing an Edge Server that is geographically closer to the visitor.
Routing is when the CDN decides to redirect requests of user to a particular Edge Server.
Good routing will redirect requests from the closest/fastest edge server to the user.
Bad routing will redirect requests from sub-optimal edge servers to the user (slower, further away, etc), either due to issues in the CDN’s performance, general errors, or internal balancing reasons.
Bandwidth can refer to the speed of the transfer of request data or the amount of data transferred by the CDN (data transfer can also be called Traffic).
The faster the speed, and the more data transferred by the CDN, the better.
I have a CDN installed, why is my site triggering the “Use a Content Delivery Network (CDN)” audit?
GTmetrix scores your CDN usage (if any) through our custom “Use a Content Delivery Network (CDN)” audit. We assigned it a medium impact score, causing many sites to consequently trigger this audit.
How is my page scored on the ‘Use a Content Delivery Network (CDN)’ audit?
GTmetrix scores this audit based on how many static requests aren’t served from a known CDN.
The higher the number of resources not served from a known CDN, the higher the impact score of this audit.
The overall effect on the Structure Score is moderate, however, as this is a Medium priority audit.
If you’re using a popular, well-known CDN, GTmetrix will likely auto-detect it for this audit. No action is necessary, and your score should reflect the CDN usage.
If your site is triggering this audit, here are few common reasons why:
The CDN is not setup properly
CDNs are setup differently across all services. While some CDNs simply require a nameserver change, others may require you to edit the URLs of your static requests, with some other CDNs requiring a different implementation altogether.
Contact your CDN support team to investigate why your resources aren’t being served via CDN.
How to check if your CDN is set up properly
As mentioned in our earlier How to Analyze a Waterfall Chart article, response headers are the main way to check if your requests are being served from an Origin Server or a CDN.
Most CDNs provide response header data to go along with the served resources:
For example, Cloudflare typically includes these response headers with each request they serve indicating Cache HIT/MISS status, Server and CF-RAY data:
StackPath usually contains an X-HW line; short-hand code for various data related to the request (Read their documentation here)
DNS has not fully propagated
If your CDN requires you to change your nameserver or CNAME, propagation will need to be complete before your website can properly serve requests via the CDN.
Propagation is a period of time Internet service providers (ISPs) around the world take to update their Domain Name System (DNS) with your new data – this may take up to 24 – 48 hours.
You can use these services to see how your site is doing DNS-wise globally:
Contact support from your hosting or domain registrar if you’re having issues resolving your DNS.
Only some resources are being served on the CDN
You may not have selected the appropriate locations, directories or file-types to serve via your CDN, or you have not entirely edited the URLs of your static requests to use the CDN.
This is especially the case for CDNs that offer setup via plugins or extensions, or for applications that have CDN settings.
GTmetrix does not recognize the CDN used
While your resources may in fact be served on a CDN, GTmetrix cannot find any matches in its CDN list. Scenarios we see often are:
The CDN you’re using is not common
You may be using a CDN that is not widespread. This is often smaller CDN services, or niche services like CDNs for images.
GTmetrix looks at response headers and cross-references a maintained list of popular, well-used CDNs to determine the CDN audit score.
If the CDN is not recognized, then your score will be affected.
Solution: If you feel your CDN should be recognized, reach out to us and we’ll review for inclusion.
You have third-party requests that aren’t served on a recognizable CDN
This is a very common scenario where webpages are embedded with third-party services that GTmetrix does not recognize as CDNs.
Large services like Facebook, YouTube, etc. are recognized as using CDNs by GTmetrix; however, there are a myriad of third-party services GTmetrix doesn’t recognize as utilizing CDNs.
This doesn’t necessarily mean the services themselves are not on a CDN – it just means the response header data they return does not match any CDNs known to GTmetrix.
Solution: Unfortunately there isn’t a solution to this (GTmetrix can’t reasonably add all third-party requests to its CDN list). The recommendation, is to review your third-party service usage and determine if they bring you value.
An excerpt from our Guidelines for a faster Shopify, Squarespace, or Wix website article:
You should be selective of which services you add onto your website…the trade-off in performance should be worth the functionality you get out of them.
Review all of your third-party resources and be sure every service is providing you value.
CDNs offer an easy way to provide immediate performance improvements to any site.
Not only do they improve performance on a latency level, some CDNs offer image optimization, script compression and security features like DDoS protection.
Are CDNs completely necessary? No – they aren’t. If you have a low to moderately trafficked website with visitors primarily located in your server’s hosted region, a CDN might not be worth the cost or effort. However, if your site has high traffic with visitors from all over the world, a CDN is highly recommended.
Fine-tune your site performance with Hourly Monitoring
Get more frequent analysis done and keep a closer eye on your site performance with Hourly Monitoring.
Available in select PRO plans (excluding Solo plan).
Other features include: Priority access for tests, More Monitored Slots, Advanced Analysis Options, Remote Location Monitoring (including Premium Locations), and more!