Content Delivery Network
Understand the mechanics of a Content Delivery Network and its role in delivering content at lightning speeds.

Published At
7/13/2022
Reading Time
~ 2 min read
CDN is a network of geographically dispersed servers used to deliver static content. CDN servers cache static content like images, videos, CSS, JS files, etc.
Dynamic Content Cache: It enables the caching of HTML pages based on request path, query strings, cookies, and request headers.
How it works:
When a user visits a website, a CDN server closest will deliver static content.
Considerations of using CDN
- Cost: Since third parties run it, it will cost you.
- Setting upon appropriate cache expiry, not too long, not too short.
- CDN fallback: If CDN fails/outrages, the client side should be able to detect the problem and request resources from the origin.
Invalidating files
You can remove a file from CDN before it expires by following operations:
- By using API provided by the vendor
- By using object versioning to serve a different version of the object, we can add parameters to the URL, such as version number.
- Web servers no longer serve static assets (JS, CSS, images, etc.). They are fetched from the CDN for better performances.
- The caching data lightens database load.
🫐
Do you have any questions, or simply wish to contact me privately? Don't hesitate to shoot me a DM on Twitter.
Have a wonderful day.
Abhishek 🙏