Content Delivery Networks
Beginner · 12 min read · High-Level Design, Caching & Content Delivery
Edge caching, push vs pull CDNs, cache keys and invalidation for static and dynamic content.
A Content Delivery Network (CDN) is a geographically distributed network of cache servers — edge servers grouped into Points of Presence (PoPs) — that serve content from a location close to the user instead of from your origin servers.
The networking lesson showed that a fresh HTTPS request across continents costs several 100+ ms round trips, and the speed of light can't be improved. A CDN attacks the problem from the other side: move the content closer to the user.
What a CDN gives you
How a request flows
Pull vs push CDNs
Most web applications use pull CDNs. Video platforms often combine both — pre-positioning popular titles (Netflix's Open Connect appliances are filled during off-peak hours) and pulling the long tail.
Controlling caching
CDNs follow HTTP caching headers from the origin (and can override them with rules).
Invalidation strategies
Beyond static files
Modern CDNs are much more than file caches:
Cost and failure considerations
When a CDN isn't the answer
Interview questions
- How would you deploy a new version of a website's JavaScript without users getting a stale version from the CDN?
- What is an origin shield and why is it useful?
- Can you cache API responses on a CDN? What are the risks?
- Pull or push CDN for a video-on-demand platform?
Practice
Write your answer before opening the suggested one. Anything you mark "Partly" or "Missed it" comes back in your review deck.
Further reading
Key takeaways
- A CDN serves content from edge PoPs near users, cutting latency and offloading the origin.
- Pull CDNs fetch on miss (default for the web); push CDNs pre-position large, predictable content.
- Control caching with Cache-Control headers and carefully designed cache keys.
- Prefer versioned URLs over purges for static assets; use purges or tags for content updates.
- Never cache personalised responses under a shared cache key.