What is a CDN?
CDN is an acronym that stands for Content Distribution Network (or Content Delivery Network). A content distribution network is a connected group (or network) of servers physically located in different places around the world. These servers work together to quickly distribute content across the internet, regardless of location.
How does a CDN work?
As we touched on, the goal of a CDN is to reduce latency. Latency is the lag or time delay between two points; i.e., the time it takes for data to get from sender to receiver.
For example, when you click on a website and it takes several seconds to load, that’s latency. Or when you hear your neighbors cheering for a goal that hasn’t yet shown on your screen – also latency.
So how does a CDN reduce latency? Let’s explain this concept using an example.
Imagine you live in Los Angeles and you’re hosting a livestream through your website. Let’s say that your content is all locally hosted (i.e., without a CDN). Your nearest server, located somewhere on the west coast of the United States, will store/hold all the data that makes the website and livestream function — all the image, text, and audio files, etc. This server is known as the origin server.
Now let’s imagine a viewer tuning in from Amsterdam.
Everything the Amsterdam viewer is trying to see and access lives on the origin server near Los Angeles. This means that every video frame they see, every image on your site, etc., all needs to be requested from a server nearly 9,000 kilometers, or 5,500 miles, away from them.
Without a CDN, it’s easy to see why their connection to your content will be slow.
The geographical distance only adds a few milliseconds of delay per request. But if you multiply that delay by the thousands (or tens of thousands) of video frames and files they need, and the lag time becomes significant. This means that from the viewer’s perspective, the stream will probably be slow, buggy, or could lose connection altogether.
Now let’s imagine the same scenario, except your website host uses a CDN.
Once your content in Los Angeles is requested by the viewer in Amsterdam, the CDN will take the content from your local server in Los Angeles and cache, or store a copy of it on the best applicable network server (usually the one nearest to the viewer). This allows their computer to request the content as if it’s local to them, drastically reducing any time delay.
What if there are simultaneous viewers connected worldwide?
Next, let’s talk about one of the most exciting features of a CDN for livestreaming purposes – scalability.
To recap: the copy of your stream data that is distributed to the viewer’s ideal server (somewhere near Amsterdam) is available for all viewers in that region. Each viewer’s ISP can grab the data from the local server more efficiently (at a greatly reduced latency). For those viewers, the CDN made the stream much stronger.
But what happens if there are also viewers in another region, like Mumbai, India, or Johannesburg, South Africa? With a good CDN, the more participants, the better.
For each new region, the CDN distributes another cache of your data. This creates data redundancy (through a new copy of your data) improving the strength and availability of your data.
The further your content spreads, the stronger your stream gets.
Most websites you enjoy today distribute their content around the globe using a CDN