CDN System Design (Edge Caching & Scale)

Design a Content Delivery Network (CDN) like CloudFlare or AWS CloudFront that caches and delivers content from edge servers located close to users worldwide. The system should reduce latency and bandwidth costs for content providers.

Constraints

Functional

Cache static/dynamic at edge, deliver from nearest edge, origin pull on miss, cache invalidation/purge, HTTPS, compression, analytics (hits, bandwidth)

Non-functional

< 100ms delivery, global edge coverage, 99.99% uptime, petabytes and terabits scale, > 80% cache hit, cost-efficient for origin

Scale

10 PB cached, 1000 edge servers, 100 regions; 1B requests/day, peak ~50K/s; ~100 KB avg response → 100 TB/day, 40 Gbps peak; 80% hits, 20% misses

Stages ahead

1Requirement Analysis
2API Design
3High-Level Design
4HLD Extensions
5Trade-offs