Authors Top

If you have a few years of experience in Computer Science or research, and you’re interested in sharing that experience with the community, have a look at our Contribution Guidelines.

1. Overview

A content distribution network or content delivery network (CDN) is a group of servers that are geographically distributed between the end users and the website’s host server to provide faster content delivery.

In this tutorial, we’ll learn about CDNs and their different types, how they work, their advantages, and the types of content they can serve.

2. How Does a CDN Work?

CDNs make content delivery faster by minimizing the distance the content needs to travel to reach the end user.

A CDN consists of multiple points of presence (PoPs) that are strategically located around the globe. Each PoP consists of multiple caching servers, aka edge servers, that cache the website’s content and deliver it to users located nearby.

For example, without a CDN, the network will look like this:

Without CDN

But with a CDN, the network looks like this:

With CDN

Edge servers store website content on hard disk drives (HDDs), solid-state drives (SSDs), or in random access memory (RAM). Further, the files that are requested more frequently are stored on faster storage mediums.

3. Advantages of Using a CDN

Using CDNs has many advantages for website owners.

3.1. Makes Websites Load Faster

The website’s content is stored on caching servers that are located around the globe. Therefore, every time an end user sends a request, the content needs to travel the short distance between the caching server and the end user instead of the long distance between the origin server and the end user. As a result, the content is delivered faster to the user.

3.2. Can Handle More Users

Because of their distributed nature, CDN servers can handle more web traffic than the origin server. As a result, more users can visit the website simultaneously.

3.3. Website Content Is More Available

Without a CDN, if the origin server goes down, the content becomes unavailable until the website owner fixes the issue. But if we use a CDN when the origin server goes down, the content is still available on edge servers, and end users can access it. In addition, if one or more CDN servers go down, other servers can replace them. As a result, the content is more available.

3.4. Reduces Hosting Costs

Web hosting providers charge for the amount of data that is transferred to and from the origin server. But if we use a CDN, since the content is stored on edge servers, less data is transferred to and from the origin server. So the hosting costs are reduced.

3.5. More Security

A DDoS (Distributed Denial of Service) attack is an attempt to make an online service unavailable to end users by flooding the origin server with requests from multiple sources. However, CDNs can handle such traffic by distributing the flood of requests between edge servers, taking the load off origin servers.

4. When Not to Use a CDN?

If most of the website’s traffic comes from users that are located close to the server, using a CDN can actually decrease the website’s performance.

For example, if we’re running a small business with a website that lets users send flowers to each other locally within a city, using a CDN means that the data needs to go through the CDN network first and then reach the users. Therefore, the content delivery speed will be reduced:

Small Business

5. Content Types

CDNs can serve two types of site content:

5.1. Static Content

Static content is a type of content that is the same and stays the same every time it is delivered to users.

Images, videos, and HTML files in a small portfolio website are examples of static content.

Older generation CDNs could only serve static content.

5.2. Dynamic Content

Dynamic content is a type of content that can change depending on the user, their time of visit, their location, and other factors. In addition, dynamic content can change while the user is interacting with it.

For example, the content delivered on social media and online shopping websites is dynamic content.

Unlike static content, dynamic content is generated by scripts in the origin server based on user requests in real-time. Newer generation CDNs can run scripts inside edge servers and generate dynamic content for the end users.

6. CDN Types

There are two types of CDN:

6.1. Push CDN

In this type, the website owners need to push the content to the CDN servers. Moreover, the website owners themselves need to manage and update the content stored on the CDN servers. So this type needs more maintenance:

Push CDN

6.2. Pull CDN

In this type, the edge servers pull the content from the origin server based on user requests. The subsequent users will receive the cached content on the CDN servers:

Pull CDN

This type of CDN requires less maintenance since the CDN itself pulls the data from the origin server. However, one disadvantage is that the first user that sends a request for the website content faces a delay since the CDN needs to pull new data from the origin server.

7. Conclusion

We learned about CDNs and their different types, how they work, their advantages, and the types of content they can serve.

Authors Bottom

If you have a few years of experience in Computer Science or research, and you’re interested in sharing that experience with the community, have a look at our Contribution Guidelines.

Comments are closed on this article!