Design a Content Delivery Network
Quick Overview
Design a CDN for serving static and dynamic content globally. Cover cache hierarchy, cache invalidation strategies, origin shielding, edge compute, and handling cache stampedes during viral content spikes.
0
Design a CDN for serving static and dynamic content globally. Cover cache hierarchy, cache invalidation strategies, origin shielding, edge compute, and handling cache stampedes during viral content spikes.
Google asks CDN design in hard onsite rounds because serving YouTube video and Cloud assets worldwide depends on edge caching, origin protection and fast invalidation. The interviewer checks that you reason about a multi-tier cache hierarchy, routing users to nearby edges, and what happens when one piece of content suddenly goes viral.
What the Interviewer Expects
- Describe request routing to the nearest healthy edge (anycast or DNS)
- Lay out the edge, regional shield and origin tiers and what each caches
- Compare invalidation methods: TTLs, versioned URLs, purge APIs
- Prevent cache stampedes with request coalescing and stale-while-revalidate
- Cover dynamic content, edge compute and cache-key design
- Plan for edge failures, DDoS absorption and capacity headroom
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you purge one object from thousands of edges within seconds?
- How would you cache personalized or authenticated responses safely?
- How do you choose which content to pre-position before a big launch?
- How do you measure and improve cache hit ratio per region?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional Requirements:
- Content Distribution: Serve static content (images, videos, scripts) and dynamic content (API responses) globally with low latency.
- Cache Hierarchy: Implemen...
Capacity Estimation
Capacity Estimation:
Assuming Google serves content to 2 billion users with an average of 10 requests per user per day:
- Total Requests: 2 billion users * 10 requests = 20 billion requests p...