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".
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".
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.
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 :)