Mastering global delivery: Serving high-performance content from edge locations to minimize latency and scale your system to millions.
Content Delivery Networks make systems cheaper and faster. They act as a distributed cache layer near your users, reducing the distance data has to travel from an origin server (like an S3 bucket or a backend API).
A delay of even 0.5s causes users to lose trust. Speed is directly correlated with perceived professionalism.
Local storage helps meet regional regulations (e.g., movies only viewable in India or specific US states).
User (India) ➔ Server (US)
User (India) ➔ Edge (India)
User requests www.example.com. The DNS doesn't return the origin server IP; it returns the IP of the nearest CDN Edge server based on geo-location.
Edge server has the file. It is returned instantly to the user (~15ms). Extreme speed as the request never hits the origin backend.
Edge doesn't have file. It fetches it from the origin, caches it locally for future requests, and then delivers it to the user (~250ms).
Images, Videos, JS/CSS, Fonts. This is the primary use case for CDNs.
Modern CDNs can handle APIs and personalized data via Edge Logic.
Cache-Control, Expires, ETag decide longevity and invalidation logic.
Requests assets
Resolves Edge IP
Checking Local Storage
S3 / Primary Data Source
Device sends request for static content.
DNS and Controller pick the closest POP based on location.
POP checks Cache. If HIT, returns in 10ms. If MISS, goes to Step 4.
Full-trip to origin. Edge caches file for all future requests.
You upload content to the CDN edge server manually or via automated triggers.
The CDN fetches content from origin automatically when a user visits a missing asset.
"There are only two hard things in CS: cache invalidation and naming things." Methods: TTL, Purge, Versioning.
Run code at the edge (PoP) for Authentication, A/B Testing, or Request Rewriting.
CDNs act as a shield, absorbing massive traffic and blocking malicious requests before they reach your backend.
Distributes traffic logically across multiple edge nodes and regions for maximum uptime.
Deliver different content per region (e.g. movies restricted by local country licensing laws).
Handling SSL/TLS handshake at the edge PoP reduces round-trip times for secure connections.