Content
- Introduction
- How It Works
- Types of Assets
- Use Cases
- Performance
- Security
- Personalization
- Conclusion
Introduction
Content Delivery Networks (CDNs) are technologies that help to efficiently distribute and deliver data around the world.
Many popular websites and applications (ie Netflix, Spotify, Reddit, Twitter, etc 🤠) are most likely to use a CDN.
Maybe you’ve developed an application that is content-rich like a blog or a news site for a global audience — then there is a high likelihood that the site is using a CDN!
So, how does a CDN work? 🤔
Before we talk about that, let’s first understand how a request works without a CDN.In an infrastructure without a CDN, the request needs to go through multiple network hops to get to the server (ie data center) and then back to the client (the user).
Depending on the distance (between the client and the server), this can have a drastic impact on the performance.
So, what is the limiting factor here?
It’s the physical distance between the server and the client
This is because the speed of light can travel only 299, 792, 458 meters per second (m/s).
That means we are limited in how fast the data can be transferred.
The only other option is to reduce the physical distance between the client and server — That’s exactly what you can achieve when you use a CDN.
By introducing a CDN, we can strategically place servers that sit closer to the user, and these servers are referred to as “edge locations”.
This allows us to minimize the physical distance between the data centers (ie servers) and the users (ie clients).
What you end up with is a network infrastructure that is optimized for global data distribution and delivery!
In the subsequent sections we’ll go through the following:
-
How it works
-
The type of assets
-
Use cases
It may seem like the data magically appears at these edge locations but that is not the case.
There is a process that happens in order to make this possible, let’s go through that in more detail.
How it works
So, when you first introduce a CDN into your infrastructure, here is what happens.
The initial request is no different than any other request, it will still reach out to the origin server to retrieve the assets (ie HTML, js, images).
After the retrieval, these assets from the initial request can now be cached at these edge locations (if the CDN is configured to do so).
It is through this process that these assets become available at these edge locations.
Then, in the subsequent request, here is where the magic happens.
It can now reach out to the edge location first to retrieve the asset (cached version) before going to the origin server.
Then when the cache expires, meaning the content is now stale, it will go through this whole process again.
Type of assets
Any type of asset that is served through the origin server can be accelerated and delivered through the CDN.
The assets include:
- HTML pages
- JS files
- CSS files
- Images
- Videos
- Files (PDF, Documents, etc)
- and other assets
Use cases
So, when would you leverage a CDN?
As we already discussed, the typical application for CDNs is for content acceleration and delivery of static content to a global audience around the world.
However, CDNs are not just limited to this application.
There are many interesting ways you customize your infrastructure through the use of a CDN.Let’s go through each of them.
Here are some areas that CDNs can be applied to:
- Performance
- Security
- Personalization
Performance
By leveraging these edge locations, content delivery can be accelerated for the global audience.
The content is moved from the origin servers to these edge locations which results in a reduction in the response times (latency).
From an end-user perspective, this means a better user experience (UX) while browsing the application.
Security
Using a CDN is not going to automatically improve security but it does provide capabilities that you can leverage to harden security.
Most of the time, the operators are responsible for adding the security features but some CDN services do provide out-of-the-box security capabilities (CAPTCHA, DDoS, etc) that you can opt into (ie Cloudflare, Fastly, Akamai).
When you have a CDN, it acts like a gateway, the request will go through the CDN before it reaches the origin server. This means, it can be used to manage or control incoming and outgoing traffic.
Some of the applications may include:
- Access management and control
- DDoS prevention
- Bot detection
- TLS management
- Managing security headers
- and much more...
Personalization
Another use case for using a CDN is the ability to personalize the content delivery based on the location.
Here are some examples:
- Providing a unique offering to a particular region (By Region)
- A/B Testing or Feature Roll out by region (By Region)
- Optimizing content and experience for a particular device (By a viewer device)
- Alter content based on a particular region (By region)
- and the list goes on...
Conclusion
Before we part, let’s do a quick recap!
Takeaways:
- CDN is a technology that improves the performance of content delivery by moving servers closer to the user
- The keys benefits of CDNs are the performance you get in the content delivery & distribution (Reducing the time it takes for content to reach the user, Latency)
- Beyond performance, other applications of CDNs include security and personalization
That’s it!
If you found this helpful or learned something new, please share this article with a friend or co-worker 🙏❤️ (Thanks!)
Lead Photo by on
Also published