What is a Content Delivery Network (CDN) and How Does it Work?

What is a Content Delivery Network (CDN) and How Does it Work? hero image

A Content Delivery Network (CDN) is something of a ‘cure-all’ for solving various issues on your website. CDNs are said to improve everything from site speed and security to account bandwidth usage. How is it that one upgrade can affect so much of a site’s performance? It all comes down to what CDNs actually do: get your site’s static content physically closer to your site’s visitors by distributing that content to other servers.

How Does a Content Delivery Network Function?

Here’s how a CDN works — normally, a website is hosted on a server, the computer that stores your site’s files. When someone visits the website, their computer queries the Domain Name System (DNS), locates the server, and retrieves the site files for you. Simple, right? The problem is that no matter how great your internet speed is or how optimized your website is, a visitor’s computer still has to reach the server. If your server is in California and your site visitor is in Cairo, the data still needs to travel halfway around the world.

Developers realized early in the web’s history that this was a problem. Content Delivery Networks treat that first server as an Origin Server and move some of your site’s data to a network of other servers spread around the globe. These other server nodes cache your static site data, letting visitors quickly load the largest site files from nearby servers that have the data ready to go.

Don’t worry, CDNs aren’t sending copies of your personal, proprietary data all over the world. CDNs cache static files, things like images, videos, and front-end code like CSS and JavaScript. Back-end data, along with most HTML, stays on the origin server.

Should You Use a CDN?

The first reason to use a Content Delivery Network is if a significant portion of your customers are located far away from your account’s server. InMotion Hosting’s servers are located in the United States (California or Virginia) and Europe (Amsterdam), depending on how your account was set up. Here’s how to check which data center you’re hosted on. If most of your customers are in a different part of the world and this seems to be having an affect on how they access the site, consider setting up a CDN.

CDNs can sometimes lead to faster site performance overall, simply because your server will spend less time sending data to each visitor. Since the origin server is only directly queried for a fraction of the site’s data, the server can more quickly serve information to more visitors. This is most clearly demonstrated with media-heavy sites. If your site has a gallery of high-resolution photos or hosts a number of large media files, setting up a CDN will take a lot of the workload off of your server.

For similar reasons, a site with a CDN can better handle sudden spikes in site-traffic. Imagine that you own a restaurant featured on a nationally-viewed cooking show. As the segment airs, thousands of people watching decide to visit your site to check out the menu. Your site, that usually gets ten or twenty visitors an hour, suddenly has ten thousand visitors in five minutes. A well-optimized server with a well-optimized site will keep everything from crashing, but adding a CDN to the mix will help smooth out the process for all of your visitors and dramatically cut down on any slowdown that may otherwise occur.

This gives CDNs a security benefit as well— protection from Distributed Denial of Service (DDoS) attacks. These attacks utilize hundreds of devices, often hacked, to overload the target site. Many CDNs have some built-in DDoS protection, coupled with specific anti-DDoS modes that can be enabled while your site is being targeted. That way, you can prevent your site from being taken offline by malicious actors.

Does a CDN Require Extra Work?

For all of the value they add to your site, CDNs are quite easy to set up. Usually, setup just requires you to use your CDN provider’s nameservers. Once you point your domain and allow for propagation time, the rest of the setup process is quite simple.

Certain plugins, addons, and site software may require additional steps. Since CDNs are so common, though, most developers will create tools that help connect site software to CDNs. Major WordPress plugins and e-commerce software like OpenCart are easy to connect to CDNs.

Once your domain begins using a CDN’s nameservers, changes made in cPanel’s Zone Editor may or may not actually edit the DNS records that site visitors and email services use to access your website. Please check with your CDN provider to find out where to adjust your DNS records and if you need to clear your CDN’s cache to propagate changes. This is especially important if you use a third-party mail service like Google Workspace or Office 365.

Be sure to read up on how your CDN uses SSL certificates, especially if you are relying on something like cPanel’s free AutoSSL. You’ll need to take some additional steps to set up the SSL to work with your CDN, and may need to activate an SSL at your CDN provider as well.

Is a CDN Expensive?

Not only are the benefits of a Content Delivery Network great, but many Content Delivery Networks are quite affordable. Cloudflare, one of the most popular CDN providers, even offers a free plan. This is a great place to start if you just want to try out a CDN, or if you’re currently experiencing a DDOS attack and need an immediate solution. Try out a CDN and see what it can do for your site.

Try combining the flexibility of a CDN with the power and customization of a Managed Linux VPS!

Posted in Glossary on

Was this article helpful? Join the conversation!