Gone are the days where any website on the web took an eternity to load. In 2021, people feel as if they are running out of time, and want a website to open instantaneously as soon as they click on it.
How fast a page will load depends on too many factors e.g. quality of the hosting stack, CDN, DNS provider, themes and plugins, the quality of coding, number of external requests, SSL handshake, the user’s internet connection speed, and the physical distance between the servers and the users!
If your website is built to target an audience from one single location or country, you are well off with selecting a hosting provider that has a data center in that region.
For example, if you belong to India, you may choose Cloudways Digital Ocean with a data center in Bangalore. Hostinger, with their Singapore data center, is also very popular for Indian website owners who target only national traffic.
But, if you want traffic from all over the world, then you must use a content delivery network (CDN).
For example, people all over the world regularly visit Scientific American, Forbes, Washington Post, Goal.com, etc. These websites can’t rely only on a hosting provider located at a certain location. Doing so can significantly slow down their website and effectively mess up their core web vitals.
Hence, they need a content delivery network (CDN) that can serve the visitor’s contents from the nearest possible locations. This greatly reduces round trip visits to distant servers, decreases page loading time, positively influences SEO and improves core web vitals of the website.
What is a CDN and how do CDNs work?
A CDN is a method to deliver content from your website or mobile application to people more quickly and efficiently, based on their geographic location. A CDN is made up of a network of servers (“points of presence,” or POPs) in locations all over the world.
The CDN server closest to a user is known as the “edge server” — when people request content from a website served through a CDN, they’re connected to the closest edge server, ensuring the best online experience possible.
Imagine that you’re in Delhi and you’ve requested a webpage on a server in San Fransisco, USA. It would typically take around 500 milliseconds to send the request and receive the response (TTFB).
If you were to request the same webpage from a server in Mumbai, it would take only about 50 milliseconds to send the request and get the response. That’s very much better than the first case
Hence, it’s beneficial for a visitor from Delhi if the content is fetched from Mumbai, instead of San Fransisco. Here comes CDN and says Hi!
In the above example, a CDN pop at Mumbai will be greatly beneficial to the user experience.
CDNs offer an easy way to increase the speed of a website while also lowering the latency. Therefore, they are essential for the fast, efficient, and secure delivery of content to users around the world. This content is not simply limited to website content alone; it can also comprise 4K and HD-quality video, audio streams, apps, games, and OS updates. With website visitor attention spans growing shorter by the day, it is imperative to deliver this content as quickly as possible. (Source: Akamai)
The CDN pop will store a full/partial copy of your webpage, and serve them to the nearest visitors, greatly reducing page loading time.
Why did I say a full, or partial copy of your webpage? I referred to static and dynamic contents.
Static and dynamic content caching at CDN pops
What are static and dynamic contents?
Let me explain by an example.
Suppose you are visiting (please do) my mom’s cooking website. For each and every visitor, the content is identical, i.e. it is a static website. If a website doesn’t serve customized content to visitors and subscribers, then it is a static website.
Now compare this to your Facebook feed. Each and every user will see different content in their feed. This is a perfect example of a dynamic website.
Similarly, Amazon may store user’s payments information, or cart that is different for all users. This is also a dynamic website.
But, HTML files are changed most frequently, and hence, they are often considered dynamic contents.
Most free CDNs like Cloudflare commonly don’t cache dynamic files, they only cache and serve static files.
Dynamic caching, which greatly reduces page loading time, is mainly served by some paid CDNs, Cloudflare APO (5$ per month), or free by QUIC Cloud CDN.
What to Look For In a CDN Solution?
Here are a few common metrics you’ll want to test and explore:
- DNS response time. Some CDNs like Cloudflare require the domain name to use their own nameservers. Cloudflare is one of the fastest DNS providers out there, but that is not the case for all the CDNs. So make sure that the DNS response time is fast enough (ideally less than ~50 ms). You can measure the DNS response time by visiting https://www.dnsperf.com/
- Peak hour performance. If your website experiences big spikes in traffic based on days of the week or times of the day, you’ll want to ensure that you your CDN doesn’t betray you when you need it the most.
- Connect time. Here, you’re specifically looking for excellent network connectivity, low latency, and zero packet loss. We always use Cloudflare DNS, which is one of the most used, fastest and safest DNS providers in the world.
- Cache Hit/Miss. You should see this expressed as a ratio in your dashboard, and you don’t want to see many requests coming back to the origin.
- Price: Using a high cost CDN doesn’t make sense if you can tweak your website to load fast enough, with good themes, plugins, and cheaper hosting providers and CDNs. In fact, you are well off with free Cloudflare plan, unless you are from India where I often experience weird routing on Cloudflare free plan. In that case, you can use QUIC.Cloud CDN or BunnyCDN.
- Other features: Users often look out for security features, web application firewalls, free SSLs etc with their CDN.
As far as what to look for in a CDN provider, you want to ensure that they have a large, diverse network. Cloudflare’s massive global infrastructure needs no introduction.
Why CDN is essential for SEO?
Here are several reasons to use a CDN:
- Speeds up your site: For visitors coming from distant locations, CDN serve them content from nearest POPs, speeding up the page loading process.
- Reduces bandwidth costs: Some web hosts like AWS and Google cloud charge you based on usage of resources. In case of a large traffic spike or a DDOS attack, your bills may shoot up to the sky. CDN saves you from this by preventing these traffic spikes to reach your origin server.
- Adds scalability: improves availability and uptime.
- Improves security by preventing DDOS attacks, bad requests, implementing other security measures like HSTS and preventing unauthorized XML-RPC requests etc.
- Modern CDNs like Cloudflare and QUIC.Cloud offers QUIC and HTTP/3 protocols for free, dramatically speeding up your website.
- Free SSL: Cloudflare and QUIC.Cloud offers free SSL certificates. Having a SSL certificate is a now a ranking factor of Google. Https is also a part of Google’s page experience update.
- Image optimization: Cloudflare Image Resizing allows several on-demand adjustments to images e.g. resizing, adjusting quality, and converting images to WebP format. Similar services are provided by BunnyCDN too.
Push and pull CDNs, reverse proxy CDNs-What are they?
Most modern CDNs use two distinct methods of caching your files: “push,” which is the traditional upload method, and origin “pull,” also known as a reverse proxy.
Origin pull/reverse proxy:
With the reverse proxy option, the first time an end-user requests a file and isn’t already loaded on the CDN POP(this is known as a “cache-miss”), the CDN will request that file from your origin server (hosting) to fulfill the user’s request. After the CDN retrieves the file from your origin domain, future requests for that file will be served from the CDN cache (cache-hit). That’s how a reverse proxy/origin pull works. When a certain request for a web page is made, the CDN will pull the web page elements and files from the origin server and serve them to the visitor – caching this version until it expires according to the cache TTL.
Two of the CDNs I mostly advocate, i.e. Cloudflare and QUIC. Cloud, both of them are reverse proxy CDNs. Setting up reverse proxy CDN is easy, you just need to play with the nameservers and DNS settings on your domain registrar and/or your hosting.
Instead of waiting for the PoP server to pull the web page data when a request is made, you are already pushing the content you want on the PoP servers even before any request is made. These contents and its data and elements will be cached until it is deleted or purged.
CDNs and duplicate content issues
Some CDNs like Cloudflare, QUIC.Cloud etc. does not alter the URLs of your web pages. But other CDNs, such as Bunny CDN appends a string in front of the URLs to work properly. E.g. if the URL is xyz.com, Bunny CDN will convert it into bunny.xyz.com. If you don’t select appropriate settings to set the canonical version to the original URL, it may trigger a duplicate content issue. Hence, always use a rel canonical header while using such CDNs.
Please read this article by Gizo for Bunny CDN settings.
Don’t worry, it’s not an issue at all. In fact, I have heard people have zero issues with such CDNs if a proper canonical header is used. BunnyCDN is an awesome CDN with very affordable pricing. But I personally prefer Cloudflare and QUIC.Cloud. They always use the original URLs. Hence no worries about duplicate content.
Cache hit ratio
One more important parameter that should be taken into consideration while choosing a CDN is the cache hit ratio. Major CDNs like Cloudflare, AWS Cloudfront, Stackpath, MaxCDN, Bunny, QUIC, etc have several PoPs around the world. But all of them PoPs do not necessarily cache your contents. If content delivered through a certain PoP is significant, then only the cache files. Otherwise, requests from that region will go to your origin server. Hence, the CDN cache hit ratio will be very low. If your target audience is quite localized, then all the contents will always be served from the nearest PoP, increasing the CDN cache hit ratio to ~90%.
If your visitors are geographically localized, some SEOs often recommend disabling CDNs. But, a CDN is always better, because they offer significant security, and prevent huge load on the origin server in case of a DDOS attack and any malicious attempts to take your website down.
Cloudflare has so many data centers around the world that it is practically impossible that all of them to get populated simultaneously, particularly for small websites and free/lower plans. Hence, most of the time, the visitors will be served from a distant PoP, or even from the origin server, rather than the geographically nearest node. This can often increase round-trip latency and slows down websites. I also found the cache hit ratio below 50% when my websites were using Cloudflare free tier.
Note: I haven’t used any paid plans of Cloudflare, but have heard good things about them. I will definitely try them out very soon and keep this article updated.
QUIC.Cloud, on the other hand, has fewer data centers/PoPs (68) around the world. Also, even the free tier of QUIC Cloud CDN has better routing than Cloudflare. In fact, the routing and performance are the same for both free and paid plans. This greatly enhances the Cache hit ratio for my website(around 85%).
Visit Cloudflare website: https://www.cloudflare.com/
Visit QUIC Cloud website: https://quic.cloud/
Which CDN should you choose?
I personally use Cloudflare or QUIC.Cloud on my websites. These two are free CDNs
The current website uses QUIC.Cloud CDN. However, the free tier is limited. But it works just fine for me because my websites are still not getting enough traffic. When they start getting sufficient traffic, maybe I have to migrate to paid versions of them. You can buy credits at a very affordable price.
Cloudflare’s free plan is often enough for new websites with low traffic. For a large traffic website, I recommend using the Cloudflare Pro plan (20$ per month), for awesome speed, better routing than free plan, web application firewall (WAF), free access to Cloudflare APO, image and mobile optimizations, etc. I haven’t used business and enterprise plans so I can’t give any opinion on that.
You can also go for paid CDNs like BunnyCDN (very cheap), Stackpath, or AWS Cloudfront (costlier but superfast)
You can always check the latency of a CDN provider on CDNPerf.
Conclusion: CDN I recommend and Disclaimer
After years of optimizing for speed and core web vitals, I am now pretty hell-bent on two things-a Litespeed hosting with LS Cache (I use Hostinger), and the built-in QUIC.Cloud CDN. Many people have personal issues with Litespeed cache, or they simply prefer Apache or Nginx. That’s fine, but you can use QUIC Cloud CDN with Litespeed web servers only. If you prefer Apache or Nginx, then go for Cloudflare (free) or BunnyCDN (paid). Upgrade to Cloudflare Pro when you have large traffic, and your website is earning you the money.
I use QUIC.Cloud CDN for all my websites and I have written an article on how I passed all core web vitals on mobile (field data).
Disclaimer: This article is not written with any intention to damage the reputation of any company/organization/CDN providers, but is purely informative.
Is CDN a ranking factor?
Speed is a ranking factor. Hence, a well-configured CDN with proper canonical URLs can boost your website’s SEO.
How to check what CDN a website is using?
You can visit CDN Planet for information related to CDN a website is using.
Are free CDNs good enough?
Yes, free CDNs like Cloudflare and QUIC.Cloud are good enough for speed and core web vitals. QUIC.Cloud is a step ahead for its dynamic content caching feature.