What is a CDN and How Do I Use It on My Website?
We’ve written about caching – what it is and how to clear your cache. A related topic is the impact of a CDN on caching – let’s go over what a CDN is, why you might use it and how to connect it to your website.
What is a CDN?
CDN stands for Content Distribution Network. What this means in geeky terms (per Wikipedia) is “a geographically distributed network of proxy servers and their data centers.” In simpler terms, a CDN can speed up your website. In addition, a properly configured CDN may also help protect websites against some common malicious attacks.
CDN services have become more popular in recent years, and today the majority of web traffic is served through CDNs, including traffic from major sites like Facebook, Netflix, and Amazon.
Why use a CDN?
Faster websites create a better user experience. While we can do some basic things to speed up a slow site, using a CDN is “next level” and can really help if your website is hosted on a shared server.
A CDN acts as a middle-man, offloading images from a website, which can take a while to load from your web hosting server, and sends those images directly to the user, making the web page load faster. This is a type of caching, and is one of the main reasons to use a CDN.
CDNs help cache content at the network edge, which improves website performance. In simple terms, CDNs serve copies of their pages (cached content) closer to your website user. For example, if a user in Italy is visiting the New York TImes website, a CDN will serve this website content from a server in Europe rather than across the ocean in New York (or wherever the NYT hosting servers are located). While the internet and a web host can and does transfer the web content from New York to Europe, there is a delay, and on large sites this can be noticeable. And as we’ve pointed out, faster websites create a better user experience. The experience for the user can be up to ten times quicker if a copy of the page (or elements of its content) can be held closer to their location and delivered on demand.
CDNs also reduce the bandwidth of your hosting, which can get bogged down on a server that is shared with other websites which may have spikes in traffic that will impact your website performance since you are sharing space on the server. If you imagine the server as a four lane highway, hosting four different, unrelated websites, when traffic in one lanes gets bad, this will affect the traffic in all lanes, as the highway serves everyone together. A CDN creates separate service road for your website content, so it isn’t affected as much by the load on the hosting server.
How to use a CDN on your website
The most popular CDN for small business websites, especially those on WordPress, is Cloudflare. Some website hosting companies, such as GoDaddy and SiteGround, offer a one-click CDN, often with Cloudflare. This makes adding a CDN to your website very easy.
If your website host does not offer a CDN option, Cloudflare offers a free plan which provides a global CDN.
Using a CDN can also cause major headaches! If your website hosting company controls the settings, or if it is improperly configured, a CDN can cache too much, preventing you from seeing your edits without clearing the cache manually each time. Too much optimizing and compressing of code can also cause issues with content displaying wrong, styles not working and functionality broken. Overly-aggressive caching can be a major headache!
Update: A day after publishing this, the CDN company Fastly was in the news for a major CDN outage, causing some of the world’s biggest websites, including Amazon, Hulu, HBO Max and many news websites to go down. When part of a CDN goes down, it affects any websites that are being served by it. So while CDNs can be a great solution to improve website performance, speed and security, they are not perfect, and must be configured and operated well to be most effective.
Twitch, Pinterest, Reddit and more go down in Fastly CDN outage https://t.co/Feyr6UW0F0— TechCrunch (@TechCrunch) June 8, 2021
Need help speeding up your website? Contact us for a free consultation!
Is your website built with WordPress?
Join our free workshop on June 24! It’s an interactive session where you can ask questions and learn how to make your school website better!