Why CDN matters in your tech stack?
Tags: webdev, architecture, cdn, performance
Published: 2022-01-26 01:56:12

Are you the one who wonders what is behind the lightning-fast websites or mobile apps that you use on daily basis?
Imagine want to buy an iPhone, to celebrate a birthday, you will definitely not drive to the iPhone's manufacturing factory, but you will go to the nearby local Cell Phone Stores, right?

The Content delivery networks aka content distribution networks or CDNs are based on same analogy.

The CDN is the network of the local stores which provide web content to millions of people like a local Cell Phone Store does.

If the web content is available nearby, it will be faster delivered to the end user. It makes online experiences performant and more reliable by delivering content with low latency, from location closer to users.

Are you the one who wonders what is behind the lightning-fast websites or mobile apps that you use on daily basis? I am the one amongst those.

Post looking at architectures and blogs of popular websites and mobile apps, I find a major common factor contributing to their performance and that is CDN

Any time we go on the internet, the lightning-fast content is delivered to us is using CND, including Facebook, LinkedIn, Netflix and Amazon.

How CDN works?
CDN accelerates the site by caching

Static assets (images, css, and javascript )
Dynamic content (sports scores, weather forecasts, breaking news, user-generated content)
Video content
and acting as a reverse proxy to your Origin Server.

PoPs (Points of Presence) Or Edge Locations are the main building blocks CDN. PoPs or edges are nearest located data centers responsible for communicating with users in their geographic vicinity

The process of accessing content cached on a CDN network edge is transparent to the user. CDN software dynamically calculates which Edge Location is located nearest to the user making the request.

The Edge locations are responsible for the caching and serving the content. They communicate with the content's Origin Server only when the new content requested is absent in the cache.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4o6wxvqoyozwhe2b4bcz.PNG)

Who uses CDNs?
Live Video Streaming- Amazon Prime Video uses AWS CloudFront CDN to deliver live streaming experience to millions of customers around the world

Website Performance- Check out how Khan Academy improved the performance of their website using Fastly CDN.

You will find many more such cases.

Do I need CDN?
If your web audience is located in many different countries, then YES.

With CDN, you bypass a trip to the Origin for faster load times. Without a CDN, the Origin (main server) must respond to every single request, that will result in

High latency

Significant traffic to the Origin

Examples of CDN providers?
Fastly CDN
Akamai
Cloudflare
AWS CloudFront
Google Cloud CDN
Azure CDN
Max CDN
Every CDN provider has detailed documentation of how to integrate your website with them. I hope by now I could convey the importance of having CDNs in the architecture.

This article is based on self-study and limited knowledge I possess. Feel free to comment and add missing things. Suggestions and corrections are welcome :-)