In the simplest terms possible: it is a global network of servers. When a user visits a website that uses a CDN, the website determines which server is the closest to the user’s location and provides resources from there. As a result, the contents travel a shorter distance to the user and take less time to load the website.
A CDN enables the rapid delivery of resources such as HTML files, JavaScript files, CSS files, pictures, and videos required for Internet content to load. As CDN services gain more traction, they are now used to handling the vast majority of online traffic, including that coming from famous websites like Google, Netflix, and Amazon.
How does CDN work?
At a high level, CDN functions as follows: whenever a user accesses a website, the CDN server that is nearest to them will provide static material. It makes sense that a website would load more slowly the farther people were from CDN servers. Users near Paris will receive material more quickly than users in Los Angeles, for instance, if CDN servers are located in London.
Using an image URL, User A tries to download image.png. The CDN provider offers the domain for the URL. The following image URL is a sample used to demonstrate what image URLs look like on Amazon. https://dataakkadian.cloudfront.net/logo_dataakkadian.jpg
If the CDN server does not already have image.png in its cache, it requests the file from the origin, which might be an online repository like Amazon S3 or a web server.
The origin sends the image.png file back to the CDN server along with an optional HTTP header called Time-to-Live (TTL), which indicates how long the picture will be cached.
The picture is returned to User A from the CDN’s cache, where it stays until the TTL runs out.
User B requests the same image by sending a request.
If the TTL hasn’t run out, the picture is retrieved from the CDN.
Thanks for reading. If you loved this article, feel free to hit that follow button so we can stay in touch.
This article is possible because of these references.