Content Delivery Network : 101

Amit Raj
Dev Genius
Published in
3 min readJul 17, 2022

--

This blog is part of the series where we discuss 101 concepts from Ground Zero for an audience that has limited starting knowledge. This article comes in the Intermediate-Level Series since it involves understanding the basics of Content Delivery Network and its importance as the backbone of modern internet traffic.

Some of the earlier blogs in the 101 Series are as follows:

DataBase Replication 101
DataBase Sharding 101
Caching Strategy 101
Kubernetes Deployment 101
Async Communication 101
Database Design 101
Document DB Modeling101

What is a Content Delivery Network?

Content Delivery Network is an inter-connected mesh of proxy servers located in data centres distributed across the globe. The primary purpose of having CDN is to improve overall latency as well as availability of business applications with customer base in multiple continents.

Since, its inception in early 1980’s CDN has become one of the most critical pieces of multi-regional deployments by optimising content (images/videos/software downloads etc) delivery through a scalable architecture of DNS and Caching blocks.

How does CDN help?

CDN’s are mainly designed to reduce the overall network round-trip between the users at multiple locations and the origin server which hosts the actual content to be served.

Without CDN

In this case, every user request independent of location being originated from, is served by the origin server. Hence, the overall latency includes the additional network hop between Locations which can span across countries/continents.

Traffic Flow

With CDN

In this case, except the first request, all subsequent requests are served by the co-located CDN Node also called as the Edge Server. Hence, the overall latency of the aggregated customer requests is independent of the additional network hop between locations, giving a better end customer experience.

Traffic Flow

How does CDN work?

Sequence Flow

  1. Client makes request for the html page www.example.com/index.html
  2. The DNS Server sends the request to the CDN Server ns.cdn1.com.
  3. The CDN determines which edge server is geographically closest and routes the request there.
  4. If the edge Server has a cached copy of the page, it serves the request without going to the Origin Server.
  5. If the edge server didn’t have a copy of the page, it routes the request from the origin server and stores it in cache for future requests.

Advantages

  1. CDN improves the overall client request latency by reducing the network hops between cloud regions which are geographically separated.
  2. Given CDN can serve cached data from edge server, it isolates client from any edge server outages. Hence improving the overall availability.
  3. CDN can be used to prevent any malicious requests through enabling protection from DDOS attacks, bot user agent and other L7 traffic filtering rules.
  4. Since a significant chunk of requests are served by the Edge Server, the workload on Origin server is minimised.

Summary

CDN is heavily used by all major internet websites to serve a variety of content such as images, videos, HTML pages, javascript etc in an efficient mode to customers across the globe. CDN as a service forms a network entry-point into architecture of majority of modern applications. Some of the most popular CDN providers are Akamai, CloudFare, AWS CloudFront , we will talk about a detailed architecture of one of them in a future blog.

For feedback, please drop a message to amit[dot]894[at]gmail[dot]com or reach out to any of the links at https://about.me/amit_raj.

--

--