CDNs: Content Delivery Networks
How globally distributed edge servers cut latency for static content, the cache hit/miss flow, and invalidation strategies.
A CDN is a network of servers distributed across the globe that serves content from the location nearest to each user. Physics is the win: shorter distance means lower latency, and no single origin carries the world’s traffic.
What Belongs on a CDN
Primarily static content: images, CSS, JS bundles, videos, fonts — anything identical for every user. Dynamic/personalized responses need more care (and often shouldn’t be cached at all).
Hit vs Miss Flow
- Cache hit — an edge server near the user already holds the asset → served immediately.
- Cache miss — edge fetches from the origin, stores a copy, serves it. Subsequent nearby users hit the now-warm cache.
This is caching with geographic distribution bolted on — all the usual concepts apply: TTLs, hit ratio as the key metric, and stale-data trade-offs.
Benefits
| Benefit | Why |
|---|---|
| Lower latency | Content travels meters, not continents |
| Origin offloading | Most requests never reach your servers |
| Scalability & availability | Traffic spikes and even origin outages are absorbed by edges |
| Cost-effectiveness | Edge bandwidth is cheaper than scaling origin capacity |
Invalidation
Cached content must sometimes change before its TTL expires (deploy day). CDNs support cache invalidation strategies — purging specific URLs or tags at the edges — plus pluggable fetch/caching behaviors to control what gets cached and revalidated.
Who Runs Them
CloudFront, Akamai, Cloudflare, Fastly — the pattern is commodity; you rarely build your own.
Part of the System Design Fundamentals series.
Related Notes
Caching Strategies: Patterns and Best Practices
Comprehensive guide to caching patterns including write-through, write-back, read-through, and cache-aside. When to use each and common pitfalls.
Single Points of Failure & Resilience
Identifying SPOFs in centralized components and the standard toolkit for removing them: redundancy, replication, failover, partitioning, and backups.
HLD vs LLD
The difference between high-level design (system architecture, modules, interactions) and low-level design (classes, APIs, database schemas, implementation logic).