Geographically distributed network of edge servers that cache content close to users. Reduces latency, offloads origin servers, and improves availability for global audiences.
Easy-Medium High FrequencyA CDN places edge servers in data centers around the world. When a user requests content, DNS routes them to the nearest edge server. If the content is cached (HIT), it's served immediately โ ~5ms instead of ~200ms from a distant origin. On a cache MISS, the edge fetches from the origin, caches it, and serves subsequent requests locally.
Edge fetches from origin on first request (cache miss), then caches locally. Simpler to manage โ no need to pre-upload. Most common model. Works great for long-tail content. Examples: CloudFront, Cloudflare, Fastly.
You explicitly upload content to CDN edge nodes. Used for large, predictable files (video, software updates). More control over what's cached where, but requires upload pipeline. Example: Netflix Open Connect pre-fills OCAs overnight.
app.v2.js) for instant invalidation.Updating content cached at 200+ edge locations is the hardest part of CDN management:
app.abc123.js โ new version = new URL, no invalidation needed. Best approach.Pull vs Push: Pull is simpler โ content is fetched on demand. Push gives control but requires upload pipelines. Use pull for web assets, push for large media (video catalogs). Netflix uses predictive push โ ML predicts regional popularity and pre-fills edge nodes overnight.
TTL length: Long TTL (24h+) = better cache hit rate, staler content. Short TTL (5min) = fresher content, more origin hits. The answer: long TTL + versioned URLs for static assets, short TTL for dynamic content.
Origin Shield: Without it, a cache miss at each of 200 edge nodes means 200 requests hit origin simultaneously. Origin shield adds a mid-tier cache โ edge nodes fetch from shield, shield fetches from origin once. Reduces origin load by 10-50ร.
Private content on CDN: Signed URLs or signed cookies restrict access. CloudFront signed URLs expire after a set time. Don't cache user-specific content on shared edge nodes without proper access controls.
CDN should be part of almost every system design that serves content to users. Mention it early when discussing global scale.
Interview signal: The interviewer wants to see you can separate static from dynamic content and understand the tradeoff between cache freshness and origin load.
| Metric | Value |
|---|---|
| Latency from CDN edge (same region) | ~5โ20 ms |
| Latency from origin (cross-continent) | ~100โ300 ms |
| Cache hit rate (popular content) | 95โ99% |
| Netflix OCA storage per server | 100โ280 TB SSD |
| Netflix peak global traffic | ~500 Tbps |
| CloudFront edge locations | 400+ |
| Cache invalidation propagation | ~5โ30 seconds globally |
| CDN bandwidth cost (typical) | $0.02โ0.08 per GB |