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 providing it to 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)
Benefits of CDN
● Security improvement- The DDOS mitigation improves the security as it contains some security certificates and optimizations.
● Increase in content availability and redundancy- Hardware failures and more traffic can lead to the website’s dysfunction. CDN can handle traffic and can withstand hardware disfunction better than many servers.
● Better load times- The visitor has a fast page loading because a nearby CDN server is used whenever a client search for a webpage. CDN also reduces the slow loading times by reducing the bounce rates and increasing the amount of time people spend on site.
● Low bandwidth cost- The direct cost for hosting a website is bandwidth consumption cost. With the help of caching and other optimizations, it minimizes the amount of data an origin server must provide, thus reducing the hosting costs.
Unlock the Power of Placement Preparation!
Feeling lost in OS, DBMS, CN, SQL, and DSA chaos? Our Complete Interview Preparation
Course is the ultimate guide to conquer placements. Trusted by over 100,000+ geeks, this course is your roadmap to interview triumph.
Ready to dive in? Explore our Free Demo Content and join our Complete Interview Preparation