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 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, and positively influences SEO.
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.
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 must now for SEO purpose.
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 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%.
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 opt 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
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).
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 is decent enough. QUIC.Cloud is a step ahead for its dynamic content caching feature. Once you start getting a large traffic, you can opt for their paid plans.