What Is a CDN? Content Delivery Networks Demystified

Learn More About HubSpot's Built-In CDN
Amy Rigby
Amy Rigby

Updated:

Published:

When I visit a website, I never consider the distance that content has to travel or the server where the website is stored. I only care that it loads fast, which is precisely why a CDN matters.

Woman at computer and servers around the world showing how a CDN works

The speed improvement from a CDN can make or break an online sale. Marketing agency Portent analyzed over 27,000 landing pages and found that a one-second load time results in a 3x higher conversion rate than a five-second load time.

If you’re wondering what a CDN is and debating whether to use one for your website, I’ve done the research for you, including speaking to HubSpot software engineers, reading online reviews, and reviewing CDN provider documentation.

Speed Up Your Website with HubSpot's Built-In CDN

Table of Contents

To understand what a CDN is, imagine you have a website hosted on a server in Denver, Colorado. We don‘t often think about websites as being in a physical location because the internet makes it seem everywhere, but a website and all of its content assets have to be based in what’s called an origin server.

So how do those assets get routed from the origin server in Denver to a visitor's browser in Boulder, Colorado? Or Tampa, Florida? Or Rio de Janeiro, Brazil?

Let's return to our website in Denver. Every time a visitor types your site address into their browser, the browser has to call upon your origin server to send, assemble, and display your content assets on their screen.

That's not so hard if the visitor is in Boulder, which is only 25 miles from Denver.

But it becomes more challenging if you have visitors from Tampa and Rio de Janeiro as well. Not only is that a lot of distance for your content to travel, but it also requires very different routing paths.

That’s why website owners like to use CDNs. Rather than have one server send content from Denver to Boulder, Tampa, and Rio de Janeiro, a CDN will deliver the assets from the server located closest to the visitor.

It’s a shorter distance to travel, resulting in faster page load times.

What is a CDN? Infographic explaining how a CDN works

What is the primary purpose of a content delivery network?

The primary purpose of a content delivery network is to deliver any type of digital content efficiently and securely to visitors, no matter where they are in the world and no matter what type of device they’re using.

Map of the world with origin server and edge servers showing how a CDN works

Image Source

To do so, CDNs have to take two major factors into consideration: geographical distance and traffic.

Geographical distance

When a visitor accesses your website — whether they're from Boulder, Tampa, or Rio de Janeiro — you want the server closest to them to deliver and display your website.

That's because the closer the server is to the user geographically, the faster the content will be delivered.

Traffic

Imagine that you post a blog on your website and it goes viral. Or imagine there's a more nefarious reason for a rush of external requests, like a DDoS attack. Any surge of traffic to your website will put a strain on your server.

Without a CDN, this might cause your server to go offline and prevent visitors from accessing your site. With a CDN, however, this influx of traffic is distributed across multiple servers, reducing the strain on your origin server and keeping your site online.

For these reasons, CDNs are essential for improving the speed and overall performance of websites that have a global reach as well as websites that experience surges in traffic or high traffic regularly.

Now that we understand the definition and purpose of a CDN, let's take a closer look at how it actually works.

How does a CDN work?

Origin server

The first thing to understand about a CDN is that it must have an origin server. As the name implies, this is where the original version of your website is stored. And when you make any changes to your website, the files are updated in this server first.

Free Web Hosting with HubSpot

Host your website on a fully managed and optimized infrastructure that scales with your business.

  • Fully managed hosting
  • No setup required
  • No storage, traffic, or usage hosting fees
  • Keep your website secure

Edge servers

Next, a CDN has multiple edge locations. These locations, usually worldwide, have servers that store copies of your website in a cache. The edge servers in the CDN call upon the origin server to get the latest versions of content for their caches. CDNs can have up to hundreds of edge servers.

So, let’s say someone in Fortaleza, Brazil, wants to visit your website. They enter your domain name into their browser, which is translated into an IP address. For a website using a CDN, the request will be sent to the edge location that is physically closest to the visitor (in this case, the one in Rio de Janeiro, Brazil).

The edge server then checks to see if that content is in its cache. If it is, as the Exponent video below explains, it sends the cached content to the visitor’s browser, where it will be displayed.

If it is not in its cache or it has expired, the edge server must get the content from your origin server, make a copy for its cache, and deliver it to the visitor.

This may seem like a lot of steps, but it all happens in milliseconds.

Closeup of an infographic showing how a CDN works

Caching

These cached files — which include your web pages, script files, stylesheets, and media assets (like images) — are then stored on solid-state and hard-disk drives (SSD and HDD) or in random access memory (RAM) for safekeeping.

So, back to our Brazil example: When the end user in Fortaleza visits your website, that data from the original version of your website doesn’t have to travel all the way from your origin server in Denver.

Instead, the CDN will call upon its closest edge server in Rio de Janeiro and send a copy of the site. This is all imperceptible to the end user, so they simply see the page loading as expected and benefit from reduced wait times without getting bogged down in the details.

So this begs the question: How do I make sure my CDN isn’t serving outdated content? There are two common ways to make edge servers refresh their cache: TTL settings and cache purging.

TTL settings

TTL (Time to Live) dictates how long content is stored before the cache updates.

If you’re using Cloudflare’s free plan, for example, you can set a minimum edge cache TTL of two hours. That means your cache will expire after two hours, at which point the edge server will fetch the latest content from the origin server and repopulate its cache.

Cache purging

However, let’s say you make a major update to your website, and you want to push it live to all visitors ASAP. To do that, you might need to manually invalidate, or purge, the cache. How this is done depends on your CDN.

For example, some of my websites used to be on the Ezoic platform, which comes with a custom CDN. Ezoic’s CDN cached my content to speed up load times, but it had this downside: Whenever I published a new blog post, it wouldn’t show up immediately on my site.

To make it do that, I had to log into the Ezoic dashboard and click “Purge Cache” to get it to instantly show the new post.

If you use HubSpot’s CMS, however, cache purging is done for you.

“We do this automatically whenever a customer updates something related to a page,” explains HubSpot Staff Technical Lead Jeff Boulter, who works on HubSpot’s CMS.

“Depending on what they change, we might purge a single page or every page on their site. Since we know where all the customer's assets (like modules) are used on a page, we know which URLs to purge.”

For other CDNs, however, it might require more technical legwork on your part to invalidate the cache.

Free Web Hosting with HubSpot

Host your website on a fully managed and optimized infrastructure that scales with your business.

  • Fully managed hosting
  • No setup required
  • No storage, traffic, or usage hosting fees
  • Keep your website secure

Beyond accelerating content delivery, CDNs can also help protect your site because they are located in front of your backend server.

From this position in your network perimeter, a CDN server can act as a bouncer for your site, blocking attacks on your website and controlling the flow of incoming traffic so that the load on each server is balanced.

Infographic showing how a website gets served with a CDN and without a CDN

Image Source

Benefits of a CDN

Faster Page Load Times

Improved performance is a key motivator for using a CDN. By placing cached content in servers physically closer to your end users, visitors will see your website load faster. This means higher engagement with your website, a lower bounce rate, and ultimately more conversions.

Protection Against DDoS Attacks

Because CDNs share the load of requests among multiple servers, they offer protection against DDoS attacks, where bots attempt to overload your server and crash your website.

Beyond that, some CDN providers offer more sophisticated DDoS protection. For example, applications built on AWS (which has a CDN known as CloudFront) are automatically protected with AWS Shield.

Reduced Downtime

Additionally, if for some reason your server (and therefore, your website) is down, your CDN will keep serving cached versions of your site — so not every end user will be affected by the outage.

Content Delivery Networks vs. Web Hosting

CDNs and Web Hosting services, while different, work together to make your website easily available to end users.

A web hosting service enables you to host your website typically on one main server (located in a “data center”), while a CDN improves website performance by increasing content delivery speed through its network of servers in multiple distributed locations.

A two-in-one platform where you can both host your website and leverage CDN capabilities makes your life easier. HubSpot’s Content Hub features a free, built-in CDN.

With HubSpot’s CDN, you won’t have to worry about setting up additional tools since it is baked into the web hosting service. This frees up your time to focus on building a great web experience for visitors.

How to Use a Content Delivery Network

Step 1: Check if your website is already using a CDN.

Before you dive into setting up a CDN, make sure you don’t already have one. You can do this by using a tool like CDN Finder.

Your site might already utilize a CDN, especially if you’re hosted on SiteGround, BigScoots, or another web host that builds a CDN into its hosting.

It also depends on your web hosting plan. For instance, I host multiple sites on the cheapest BigScoots plan, 105cc, which is shared hosting that does not include a CDN. If I upgraded to BigScoots’ Managed WordPress hosting, I would automatically get the CDN.

For one of my sites hosted on BigScoots, I use WordPress as the CMS. WordPress doesn’t have a built-in CDN, so this site does not have a CDN because I never set it up on a separate CDN provider.

As such, its load time is embarrassingly slow at 5.98 seconds when I checked it on Pingdom.

Screenshot of Pingdom results showing a 5.98-second load time without a CDN

Image Source

For another one of my sites hosted on BigScoots, I use Squarespace as the CMS. Squarespace is unique in that, whenever I upload images or other files, it automatically stores it on its built-in content delivery network.

Unsurprisingly, this CDN-enabled site has a much faster load time.

[alt]

Screenshot of Pingdom results showing a 1.62-second load time with a CDN

Image Source

Step 2: Choose one of three ways to use a CDN.

There are three ways you can use a CDN:

  1. A CMS with a built-in CDN
  2. A web host with a built-in CDN
  3. A separate CDN provider

1. Using a CMS with a built-in CDN

This is one of the easiest ways to reap the benefits of a CDN without spending time on configuration. When you manage your site with a CMS that has a built-in CDN, such as WordPress.com, Squarespace, or Content Hub, there are no extra steps.

2. Using a web host with a built-in CDN

Another simple way to get a CDN is to use a web host with one included, such as SiteGround or Bluehost.

3. Using a separate CDN provider

Of the three options, using a separate CDN provider is the most technically complex. Typically, a developer will need to set this up.

The easiest option here is to use Cloudflare, which has the simplest setup compared to Amazon CloudFront or Google Cloud CDN (reviewed below). As a non-developer, I was able to set up Cloudflare’s CDN because all I had to do was change my nameservers.

For other CDN providers, you’ll need to be comfortable using developer platforms.

For example, to set up Amazon CloudFront as a CDN, you’d need to take multiple steps, including:

  1. Creating an Amazon S3 bucket to store your files
  2. Creating distributions, which tell Amazon CloudFront where to find your content
  3. Configuring settings, such as viewer protocol policy, HTTP methods, and minimum TTL

You can see the full process for creating a distribution in Amazon CloudFront in this video:

Below, we'll take a look at a few different options for building a site with a CDN.

Free Web Hosting with HubSpot

Host your website on a fully managed and optimized infrastructure that scales with your business.

  • Fully managed hosting
  • No setup required
  • No storage, traffic, or usage hosting fees
  • Keep your website secure

Best CDNs

CDNs can reduce latency, increase page speed, minimize bandwidth consumption, and block data scrapers and other forms of spammers targeting your site. To improve the speed and security of your site, choose a platform with a built-in CDN or a CDN provider.

Let's look at a few CDN options below.

1. HubSpot's Content Hub

The HubSpot Content Hub, which comes with a built-in CDN

If you use Content Hub to host your website, you'll already have a built-in CDN. There‘s no configuration, setup, or additional accounts required, and you won’t have to purchase and install one from a third-party provider.

HubSpot has a global CDN that delivers content quickly, securely, and with less latency. And your CMS-hosted website, blogs, and landing pages will also be protected by HubSpot’s security monitoring.

That means you can focus on building a great site without worrying about distribution, cache invalidation, or online attacks.

Best for: Small and medium-sized businesses with little to no developer resources. Content Hub is a CMS with a drag-and-drop webpage builder, making it super accessible to non-technical users. Plus, it automatically puts your website on a CDN, so you don’t need to worry about setting it up.

Pricing: HubSpot’s CDN is included at no extra cost with your Content Hub account, which has a free plan.

2. Cloudflare CDN

Cloudflare CDN website

Cloudflare has a global network of data centers in 330 locations across more than 120 countries. By combining data with machine learning, Cloudflare sends content requests along the fastest and most reliable paths on its network.

Best for: Businesses, small and large, looking for a free and easy-to-implement CDN.

When I struggled to optimize page speed on one of my blogs a few years ago, the WordPress support service I was working with recommended installing Cloudflare to speed up server response times.

Similar to HubSpot, Cloudflare’s CDN is built into its other offerings. But as far as technical setup, you do have to take one extra step: changing your nameservers to point to Cloudflare’s servers.

I was able to do this on my own despite not being a developer, so I can vouch for Cloudflare being simple to set up. Honestly, the hardest part was being patient with the DNS propagation. It took a few hours for the DNS records to update after I changed them, which had me worried at first.

Pricing: Cloudflare offers a CDN with its free tier.

3. Amazon CloudFront

Amazon CloudFront CDN website

Amazon CloudFront is a CDN service with edge locations in more than 100 cities around the world. Known for its low latency and high transfer speeds, Amazon CloudFront also provides DDoS protection and offers multiple ways for you to configure your CDN.

Best for: CloudFront is great for businesses already using AWS. It is also clearly more suited to complex applications and websites, so if you’re building something beyond a simple marketing website, opt for CloudFront.

However, many G2 reviews say that CloudFront is extremely technically complex to set up. So if you’re not a developer or don’t have access to an engineering team, CloudFront may not be for you.

Pricing: Amazon CloudFront offers a free tier of up to 1 TB/month of data transfer out. After that, it has pay-as-you-go pricing model with no upfront fees or required long-term contracts.

However, the pricing is hard to predict. That’s because it changes based on a few variables, including:

  • HTTP/HTTPS requests
  • Real-time log requests
  • Data transfer out

4. Google Cloud CDN

Google Cloud CDN website

Google Cloud CDN uses Google’s global network of over 100 edge locations. Pull content from HTTP-capable origins including Compute Engine, Cloud Storage, and Google Kubernetes Engine backends.

The CDN does not come with extra DDoS protection. For that, you’ll have to pay for Google Cloud Armor.

Best for: For organizations already using Google Cloud Platform, using Google Cloud CDN just makes sense. G2 reviews seem to show that it’s easier to set up compared to Amazon CloudFront.

However, Google Cloud CDN has the fewest edge locations of any of the CDN providers in this list — something to keep in mind if you’re worried about coverage.

Pricing: Google offers a free trial with a $300 credit. After that, similar to Amazon CloudFront, Google Cloud CDN’s pricing varies depending on a few factors. Google offers a nifty pricing calculator to estimate how much you’ll pay.

Google Cloud CDN cost calculator

What is a CDN? A Must-Have Enhancement to Your Website

Because there are so many free CDN options out there, I can’t think of a reason you wouldn’t get one. In fact, I’m looking at setting up Cloudflare on my BigScoots-hosted website, as it’s an easy way to speed up that slow load time.

For website visitors, a CDN is the unsung hero that makes websites load faster. For website owners, it offers improved site performance, protection against attacks, and peace of mind.

Editor's note: This post was originally published in July 2014 and has been updated for comprehensiveness.

Free Web Hosting with HubSpot

Host your website on a fully managed and optimized infrastructure that scales with your business.

  • Fully managed hosting
  • No setup required
  • No storage, traffic, or usage hosting fees
  • Keep your website secure

 

Topics: Web Hosting

Related Articles

Speed Up Your Website with HubSpot's Built-In CDN

GET HUBSPOT'S BUILT-IN CDN

CMS Hub is flexible for marketers, powerful for developers, and gives customers a personalized, secure experience

START FREE OR GET A DEMO