Over the last few years there has been a huge increase in the number of Internet users. YouTube alone has 2 Billion users worldwide, while Netflix has over 160 million users. Streaming content to such a wide demographic of users is no easy task. One can think that a straightforward approach to this can be building a large data center, storing all the content in the servers, and provide it to the users worldwide. But there are issues that arise when this approach is followed-
- Firstly if the data center is in the USA and the user is in India there will be slower delivery of content.
- Secondly, a single data center represents a single point of failure.
- Thirdly, if some content is being accessed frequently from a remote area then it is likely to follow the same links, and this, in turn, results in wastage of bandwidth.
CDN – Content Distribution Network or Content Delivery Network is a solution that provides faster delivery of content to the users distributed worldwide.
What is a CDN?
A CDN is essentially a group of servers that are strategically placed across the globe with the purpose of accelerating the delivery of web content. A CDN-
- Manages servers that are geographically distributed over different locations.
- Stores the web content in its servers.
- Attempts to direct each user to a server that is part of the CDN so as to deliver content quickly.
How does CDN work?
To minimize the distance between the visitors and your website’s server, a CDN stores a cached version of original content in multiple geographical locations (a.k.a., points of presence/ PoPs). Each PoP contains a number of caching servers known as edge servers that are responsible for content delivery to visitors within its proximity. CDN caches content in many places at once, ensuring quick delivery of content.
Let’s consider an example:
Suppose you are hosting a website, wherein your origin server(server containing the primary source of your website’s data, where website files are hosted) is located in Australia and a company XYZ provides you the CDN service.
When a user in India clicks on a video on your website, the request goes to the user’s local DNS server(See DNS), which relays the request to the authoritative DNS server of your website.
The authoritative DNS server then identifies that the user is situated far away and therefore relays the request to its XYZ’s DNS server. Now the DNS query enters XYZ’s network which provides the address of the edge server that is closest to the user to the Local DNS server. The video is delivered by this edge server.
From this point onwards the local DNS server knows the address of the edge server. So whenever users within its network send a request for content from your website, the local DNS server shall relay the request to the edge server.
CDN thus minimizes the number of hops required to deliver the data to a user’s browser due to the POPs that are located near the user.
Following image depicts the same:
Following Image depicts the difference between how a request is handled with and without a CDN respectively:
WITH CDN(2 SECONDS)
WITHOUT CDN(5 SECONDS)
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Basic Network Attacks in Computer Network
- How do Web Servers work?
- How Does the Blockchain Work?
- 10 Best Work From Home Jobs
- How Do Search Engines Work?
- Proof of Work (PoW) Consensus
- Mistakes You Must Avoid During Work From Home
- How to Make Your Work From Home More Productive?
- Difference between Storage Area Network (SAN) and Network Attached Storage (NAS)
- Differences between Wireless Adhoc Network and Wireless Sensor Network
- How does Ripple Protocol Consensus Algorithm work ?
- 5 Ways to Maintain the Security During Work From Home
- 13 Study Tips For Students - Smart Work is the Key of Success
- How does Multiprotocol Label Switching (MPLS) Routing work ?
- Which Linux distribution shall I choose?
- Content Spoofing
- How to Serve Static Content using Node.js ?
- How Content Writing at GeeksforGeeks works?
- Content Management Systems - An Overview
- How to get raw content from a string including carriage return ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.