Content Delivery Networks (CDNs)
Tags: cdn, api, systemdesign, network
Published: 2023-09-20 13:43:03

Hello folk! Today we’re going to talk about CDN witch is a part of our global topic “Web Api Performance” and i hope that you guys are ready!

Let’s go 🚀 …

![CDN](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/shu41p41nw0e7ick0a5p.png)

**What is a CND ?**

In web API performance, a CDN stands for “Content Delivery Network.” A CDN is a network of distributed servers strategically placed in multiple data centers around the world.

---

**What is it used for ?**

The primary purpose of a CDN is to deliver web content, including APIs, to users more efficiently by reducing latency and improving availability and scalability. CDN caches contents next to the final users so that it can send resources quickly to them.

Resources like

_Static Content_: HTML pages, Javascript files, css styles, images, videos.

_Dynamic Content_: While CDNs are primarily known for caching static content, some CDNs offer features for caching dynamic content as well. This includes dynamically generated web pages, API responses, and database-driven content.

_Software Updates_: CDNs are used to distribute software updates and patches. Companies often use CDNs to deliver software updates to their users, ensuring faster and more reliable downloads.

_Streaming Media_: Many CDNs support the delivery of streaming media content, such as video and audio streams. Content can be distributed globally to reduce latency for viewers.

_Large Files_: CDNs are also useful for distributing large files, such as software installation files, documents, and datasets. They can efficiently handle the transfer of large files to users, again reducing the load on your origin server.

---

**CDNs vs Web Hosting**

Sometimes when defining CDNs, they can be confused with web hosting. So we added this section to explain the difference and make it clear to you.

Web hosting is primarily used to store and serve website files, databases, and web applications from a centralized server, while CDN is to enhance the delivery speed, availability, and scalability of web content.

When it’s about content delivery, DNs distribute cached content globally, making use of edge servers to serve content from locations closer to end-users, while Web hosting serves content from a central server, which may not be optimized for global content delivery. Without a CDN, users farther from the hosting server may experience slower load times.

Finally a website can use a Content Delivery Network (CDN) to improve its performance, reliability, and content delivery. By using a CDN, a website can provide a better user experience by reducing latency, improving load times, and enhancing content delivery to users around the world.

But CDNs are independent services that work in conjunction with websites, but they don’t require a specific website to function.

---

**How do they work ?
**
Different CDNs use different process and technologies for driving user requests to the closest POPs..

— Let’s take a break! **What is a PoP**?

PoP stands for **P**oint of **P**resence and is one of the multiple servers deployed by a CDN at multiple locations all over the world.

Now we continue with the explanation of how a CDN works 👇🏾

There is a lot of technologies that CDNs use but two common technologies are : **DNS-Based Routing** and **AnyCast**

**DNS-Based Routing**:

In DNS-Based Routing, each Point of Presence (PoP) has it’s own IP address so when the user request for a specific content to a CDN, this one (The CDN) returns the IP address of the PoP closest to the user.

**AnyCast**:

Things go differently with the anycast process, because in this case all PoPs have the same IP address and when a user request arrives on the anycast network, the network redirects the request to the nearest PoP to the requester .

**Conclusion**:

Using a Content Delivery Network (CDN) offers several key advantages:

**_Improved Performance_**: CDNs reduce latency by caching and delivering content from edge servers geographically closer to users, resulting in faster load times.

**_Scalability_**: CDNs efficiently handle traffic spikes, ensuring your website or application remains responsive even during high-demand periods.

**_Global Reach_**: CDNs have a worldwide presence, making your content accessible and fast for users across the globe.

**_Caching_**: They cache static and dynamic content, reducing the load on your origin server and minimizing server costs.

**_Security_**: CDNs often provide security features like DDoS protection and web application firewalls, enhancing your website’s protection.

**_Cost Efficiency_**: CDNs can lower bandwidth and server costs while improving performance and reliability.

In conclusion, CDNs enhance content delivery, performance and scalability for websites and applications, ensuring a faster, more reliable, and cost-effective user experience.

Follow me there :

linkedin.com/in/laetitia-christelle-ouelle-89373121b/

twitter.com/OuelleLaetitia

dev.to/ouelle

Happy coding ! 😏