Home System Design Tutorial What is CDN and how does it work?

What is CDN and how does it work?

CDN or Content Delivery Network is a global network that is used to minimize the distance between the visitor and the Website server and reduce the network latency. It does this by caching static content for a website (i.e, images, HTML pages, javascript & CSS files, and videos) and loading the static content from the geographically closer server called PoP or Point of Presence.

CDN came into existence in the 1990s to diminish the performance bottleneck of the Internet. Now CDN is a crucial backbone of the modern internet to serve downloadable objects (media files, software, documents), applications (e-commerce, portals), live streaming media, on-demand streaming media, and social media sites.

Content Delivery Network(CDN)
Content Delivery Network(CDN)

Left: Distribution using single server                                    Right: Distribution using CDN

How Does CDN Work

CDN is a collection of many caching servers in multiple geographical locations each(a.k.a., points of presence, or PoPs) connected together. Each PoP contains the cached version of the website. When a user requests a webpage, the CDN algorithm redirects the request to the server which is closest to the location of the requesting user(i.e, the location with the fewest hops), hence decreasing the latency and optimizing the performance.

CDN VS Load Balancer

Both CDN and Load Balancers are used to maximize the website/application uptime.

But a CDN is only good for serving static files only. Many sites cache static assets in CDNs because these files do not change often, and response times for serving those cached assets are quicker than requesting from the origin server.

For Serving anything dynamic we will prefer a Load Balancer. Dynamic content such as server-side code, and databases( which change frequently), will be benefited by having multiple servers behind a Load Balancer.

What are the benefits of using CDN?

  1. Improved Website Load Time – By delivering the content from the nearby CDN server to the user (a.k.a POP), the user experience less page loading time.
  2. Reduced Bandwidth Requirement – CDN is able to reduce the bandwidth requirement of website hosting by reducing the amount of data, the original hosting server has to provide.
  3. Fault Tolerance – By distributing the data geographically among many servers, the CDN can handle more traffic and make the system fail-safe(i.e, even if one CDN server goes down, others will keep on functioning).
  4. Improved Website Security – CDN improve security by providing DDoS protection and a web application firewall.

Example of CDN providers

  1. Amazon Cloud Front
  2. CloudFare
  3. Azure CDN
  4. MaxCDN
  5. Google App Engine


Please enter your comment!
Please enter your name here