DEV Community

Cover image for Why CDN matters in your tech stack?
Vani Kulkarni
Vani Kulkarni

Posted on

Why CDN matters in your tech stack?

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

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
AWS CloudFront
Google Cloud CDN
Azure 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 :-)

Top comments (5)

honorbertt profile image
Ho Norbert

I tried to understand the CF's documentation. You can’t figure it out without a support service, unfortunately the support is so-so

honorbertt profile image
Ho Norbert

G-core's CDN is the coolest, I would add it to the list.

nikmikhailov_ profile image
Nik Mikhailov

Yes, good, especially the free plan, free protection and SSL is cool

nikmikhailov_ profile image
Nik Mikhailov

Yeah, CDN is the coolest thing. We work with G-core in Europe, they have a lot of locations there. For an online store, this is an indispensable thing, bounce rate, SEO, etc.

anandsunderraman profile image

Liked the analogy. It helped put things in perspective.