CDN is short for Content Delivery Network. It's a geographically distributed group of servers that work together to provide fast delivery of internet content.
So when we type this line :
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
we're basically asking google fonts to provide us with the particular font design.
Network: Why is it called network?
It's called a network since bunch for servers work together to send "content" back to the client.
If you've played any of multiplayer online games like Dota or CS:GO, there's a command which we type: "ping" and it returns something like "100ms" or "40ms".
dota 2 ping for different regions
Ping is how much time it takes for the server to return the content asked by the client. So 100ms means that it takes 100ms for client -> server -> client data transfer. So in this case, if I am connected to a USEast server, then the data exchange between me and the server on which the actual game is running takes 26ms.
But why a cluster of servers?
Now imagine you're in US, and you want to play with your friend in India so you decide to join a server in India. So for data transfer between you and the server now takes 300ms on average, which doesn't seem much but for a high paced game like Dota, it's too much or as gamers call it "LAG".
Here's an example of the same in Fortnite:
In this case if player 1 ping = 300ms and player 2 ping = 26ms, the actions performed by player 2 are received, processed, and distributed much faster compared to player 1.
The same applies to all other services like Netflix, Spotify etc. It would be unfeasible to store all movies and TV shows, at one location.
To tackle this, they install a bunch/cluster of servers in many different locations that contain data, and these in turn are connected to the main server which provides all the data.
Implementing this kind of network has many advantages:
1> Decreased load : Each server will serve customers in that region which brings down server load of whole system.
2> Faster Content Delivery : Since load is decreased, it's easier on server transfer files.
3> Protection against potential DDOS attacks : Since there are many servers located, if one server is affected by DDOS attack, other backup servers will kick into action and serve customers in that region, and overloading the main server becomes difficult.
4> Analytics : Companies like Netflix use the data about things like, most-watched movies / TV shows in that region and use that data to update their regional servers so that relevant content is available to customers.
Eg: if customers in US are watching "Stranger Things" at high demand and customers in South Korea are watching "Kingdom", Netflix will update their local US and Korean servers accordingly.
Netflix, in particular, goes beyond. Netflix ties up with local ISP to install boxes similar to these :
Since the population density of Mumbai is higher compared to that of New York, Netflix might end up installing more of these boxes in Mumbai to serve their customers.
Comment down below if I missed something or messed somewhere.
Thanks for reading :)
Top comments (9)
I like how you wrote this article.
Regarding CDN, I've always wondered if it's really worth it for a lot of sites that are using it.
If you don't have heavy resources (videos. large-resolution images, etc), I don't think a user would notice that the site loaded 2 milliseconds faster.
True that, infact Netflix is handling all it's video content via CDN, and the rest of the stuff like handling billings, user logins, recommendation system etc is using AWS and Google cloud.
Bruhh! Don't want to read? Watch the text converted video -.. :) youtu.be/G4owjm4wKJs
Holy shit !! awesome man!
CDNs boost the speed of websites by caching the content in multiple locations around the world that's the reason why cdn is important for video streaming as the request to content go to a cdn server which may be thousands of miles and across multiple autonomous networks from the user.
Thanks you ! glad you liked it !