Content Delivery Network(CDN) in System Design (original) (raw)

Last Updated : 14 Apr, 2026

A CDN (Content Delivery Network) is a distributed network of servers that deliver content to users from the nearest location. It improves website speed and user experience by caching content closer to users and reducing latency. Edge servers are placed across different regions to enhance performance and efficiency.

**Example: When a user in India visits a website hosted in the US, a CDN serves the content from a nearby server in India, making the website load much faster.

1. Without CDN

When a user requests content from a website without a CDN****,** the request is sent directly to the origin server where the website is hosted. The origin server processes the request and sends back the requested content to the user's device.

ser

Without CDN

2. With CDN

When a user requests content from a website with a CDN, the CDN identifies the user's location and routes the request to the nearest edge server. Edge servers are distributed across different regions and store cached content closer to users, enabling faster delivery.

origin_server

With CDN

Real-World Applications

Content Delivery Networks (CDNs) are widely used by large-scale platforms to deliver content quickly and efficiently to users across the globe.

Types of CDN

CDNs can be classified into several types based on their architecture and functionality:

**1. Public CDNs

Any CDN that is accessible to everybody online is referred to as a public CDN. These CDNs are used to swiftly and effectively provide content, including pictures, movies, and other static files, to users. They usually consist of a vast global network of servers.

**Example: Cloudflare, Akamai, and Amazon CloudFront.

**2. Private CDNs

A CDN that is only utilized by one firm or organization is known as a private CDN. These CDNs are used to distribute content to internal users or clients, and they are frequently set up on a private cloud or within an organization's own infrastructure. More control over content distribution is possible with private CDNs, which may be customized to satisfy particular performance and security needs.

**Example: Google Cloud CDN, Netflix Open Connect.

**3. Peer-to-Peer (P2P) CDNs

These CDNs utilize peer-to-peer networking technology to distribute content directly between users, reducing reliance on centralized servers.

**Example: BitTorrent, webTorrent.

**4. Hybrid CDNs

A hybrid CDN combines elements of both public and private CDNs. In a hybrid CDN, some content is delivered using a public CDN, while other content is delivered using a private CDN. This approach allows organizations to optimize content delivery based on factors such as cost, performance, and security requirements.

**Example: Microsoft Azure CDN

**5. Push CDNs

In a push CDN, content is uploaded or "pushed" to the CDN's servers in advance of when it is needed. This can help improve performance by ensuring that content is available closer to end users when they request it. Push CDNs are often used for caching large files or content that is not frequently updated.

**Example: KeyCDN, CDN77

**6. Pull CDNs

Pull CDNs fetch content from the origin server when requested and are mainly used for caching static or frequently accessed content. Dynamic content may be delivered but is usually cached selectively or for shorter durations.

**Example: Amazon CloudFront, Cloudflare

Components

A typical CDN consists of the following key elements

Working

Step-by-step working of a CDN:

ds

Working

  1. User sends a request for content (e.g., an image) from a website.
  2. CDN identifies the user's location and routes the request to the nearest edge server.
  3. If the content is cached at the edge server, it is delivered directly to the user.
  4. If the content is not cached, the edge server retrieves it from the origin server, caches it locally, and delivers it to the user.
  5. Cached content is stored at the edge server for future requests, optimizing performance and reducing latency.

Types of Content Delivered by CDN

A CDN can deliver different types of content based on how frequently the data changes and how it is generated.

1. Static Content

Content that remains the same for all users and does not change frequently.

2. Dynamic Content

Content that changes based on user interaction, location, or preferences.

Importance

CDNs offer several key benefits that make them important for delivering content over the internet:

Challenges

The challenges of using CDN are: