What is a CDN & why should you use one?
CDN’s (Content Delivery Network’s) have become incredibly widely used these days when it comes to creating and maintaining a high performing, international website - yet a lot of people starting out aren’t necessarily always aware of them or whether they need one.
Whilst not a prerequisite for a high performing website (more on this later), if your readers/viewers are based all around the world, a CDN may be just the solution you’re looking for!
What is a CDN?⌗
In the simplest possible terms - a CDN is a bunch of servers, interconnected with each other but located all around the world (you’ll notice the locations trend further down). Known as “edge servers”, these nodes cache certain content for websites that are stored upon them.
This content is usually images, Javascript or CSS as these are the most resource heavy/time consuming elements of any website. The content is usually “static”, meaning it doesn’t change all too often, therefore caching a copy of it on each server is no major problem.
When a user then visits your website, the content you’ve placed on your chosen CDN will be served via that CDN as opposed to directly from your web server - leaving you with extra computing power (meaning you could serve content to more visitors) and less bandwidth used (if you’re on a hosting plan with limited bandwidth).
How does a CDN work?⌗
A CDN works in much the same way as any other web server works. It serves up the files requested by a visitor/reader of a site as and when requested. The whole purpose of a CDN is to minimise the distance between a visitor and the resources they need for a website.
If you take a look at the following image:
Image from GTmetrix
You can see that by using a CDN that when a user visits your site, they will (generally) experience quicker connection times, faster loading times (due to a shorter connection distance/higher powered servers) and generally lower latency due to shorter round-trip distances. With these edge servers/nodes placed all around the world, you can serve up pages from your website as quickly to those visiting your site on one side of the world as quickly as you would those based in the same country as your hosting platform.
OK - that’s great… but do people really use these?⌗
They do indeed! Chances are you interact with them on multiple occasions every day - you’ve loaded content from one just by reading this article or visiting my website! :) I recently switch out to using both CloudFlare & AWS CloudFront, with each serving up different content.
CloudFront now serves up all imagery for my site/blog posts, whilst CloudFlare deals with my DNS and any HTML, JS or CSS final minification, as well as the caching of other static content that is non-image based. I also utilise CloudFlare’s RocketLoader for JS optimization.
If you look at services like YouTube or Netflix, all of the content on both of these websites are/will be served via a CDN, simply due to the fact that serving all of the content from a single location would result in those furthest away experiencing massive lag and inability to stream content. Whilst YouTube runs on Google’s own (and in some cases - Akamai’s) CDN, Netflix is running on Amazon’s AWS platform.
It’s not just YouTube and Netflix though - Amazon UK, Instagram, Microsoft, Domino’s (because pizza should be served quickly!), IKEA, Google (I know these are all big names, but they’re just the most commonly known examples) all use a Content Delivery Network in some way, shape or form.
Chances are, if you visit a website that is using a Google Font, this will be being served via Google’s CDN. Not only that, but any website you visit that contains adverts (or would contain adverts if you use AdBlock) - you can be 99% sure that these ads are served via a CDN.
So - should you use one?⌗
In all honesty… not everyone needs a CDN. If you look at the above examples (and any other website that use a CDN), you’ll notice one common denominator between them all: every single one of these sites has viewers/readers/visitors from all around the world.
If your reader-base is based within the same country as you (and therefore likely the same country as your hosting platform), then a CDN will provide little to no benefit in terms of speed of loading your website. Yes, you may be able to offload a little bandwidth usage and I/O… but that’s all you’ll save really.
Whilst not a significant amount of effort is required to setup a CDN for your website, it may not be worth the time to do so. Some hosting plans include a “free” Content Delivery Network, such as Bluehost or 1 & 1 - most of the time you’ll find this is utilising Cloudflare’s CDN. If your plan includes it, you may as well enable it as it’s part of what you’re paying for and is usually a one-click setup type job.
Where can you get a CDN and how much does it cost?⌗
In all honesty, there are a lot of CDN offerings out there with a range of costs and varying price plans per “host” - so answering the cost part of that question is a tricky one. Dependent on performance, added extras, scale and other variables - you could be looking at a completely Free CDN or you could be looking at business-grade CDN requirements which could cost you £300+/month.
As you can see - that’s a fairly significant price range!
Each CDN then comes with a varying level of complexity to setup, however on the most part they’re all quite easy to get up and running with your site. As long as you’re familiar with DNS setup/configuration and are able to follow step-by-step instructions, you shouldn’t have any issues.
If you opt for a paid plan, you typically also get support included so any niggles you may have you can be sure that someone will be there to help you along the way.
Reputable/Well known Content Delivery Networks⌗
To name a few of the more popular CDN’s and help you get started with setting up a CDN on your site (if you’ve decided it’s worth your while):
Cloudflare Cloudflare’s network of 116 datacenter’s based all around the world
MaxCDN MaxCDN’s network of 18 edge servers based all around the world
Amazon Cloudfront Amazon’s network of ~93 servers/edge locations based all around the world
Google Cloud CDN Google Cloud CDN’s network of 80+ CDN edge servers based around the world
KeyCDN KeyCDN’s network of currently active PLUS planned edge servers
Cachefly It’s a bit easier to view this map directly on CacheFly’s website: https://web1.cachefly.net/assets/network-map.html
Notice the general trend with regards to the location of the edge servers? This should be what matters more to you than how many edge servers there are.
If your site is receiving most of its views from Australia and South America, you want to be looking at a network that offers more PoPs (Points of Presence - a.k.a Edge Servers) in those regions.
In the above examples, that boils down to Google’s Cloud CDN or CloudFlare.