How to answer any system design question
A repeatable 8-step framework for a 45-minute interview, the numbers worth memorising and a fully worked example.
The framework
Clarify requirements
5 minAsk who the users are, which features are in scope and what “done” looks like. Separate functional requirements (shorten a URL, redirect) from non-functional ones (latency, availability, consistency, scale).
Estimate the scale
5 minRough numbers decide the design: requests per second, read/write ratio, data size per year, bandwidth. Round aggressively — one significant figure is enough.
Define the API
5 minWrite the main endpoints or events with inputs and outputs, e.g.
POST /urls {longUrl} → {shortCode}. This pins down the contract before the boxes.Model the data
5 minList the main entities, their key fields and how they are queried. The access pattern drives the choice of database and keys.
Draw the high-level design
10 minClients, load balancer, services, databases, caches, queues. Walk one request end to end and make sure every requirement has a home.
Deep-dive the hard parts
10 minPick the two or three riskiest components — the hot path, the biggest table, the consistency boundary — and go deep: sharding, caching, failure handling.
Find bottlenecks & failures
3 minWhat breaks at 10× traffic? What happens when a node, zone or dependency fails? Add replication, retries, circuit breakers or queues where needed.
Summarise trade-offs
2 minRecap the design, the main trade-offs you made and what you would do next with more time. Interviewers value honest trade-offs over a perfect diagram.
Numbers for quick estimates
| Seconds per day | ≈ 86,400 (round to 100,000) |
|---|---|
| 1 million requests per day | ≈ 12 requests per second |
| 100 million requests per day | ≈ 1,200 requests per second |
| Peak traffic | Plan for 2–5× the average |
| 1 KB × 1 million | 1 GB |
| 1 KB × 1 billion | 1 TB |
| Read from RAM | ~100 ns |
| SSD random read | ~20–100 µs |
| Round trip in one data centre | ~0.5 ms |
| Round trip across an ocean | ~150 ms |
See Latency numbers & the memory hierarchy for more.
Worked example: a URL shortener
1. Requirements
- Create a short link for a long URL; redirect short links to the original.
- 100 million new links per month; reads outnumber writes 100 to 1.
- Redirects must be fast (p99 under 50 ms) and highly available.
2. Estimates
- Writes: 100M ÷ (30 × 86,400) ≈ 40 per second; reads ≈ 4,000 per second, peaks ~20,000.
- Storage: 100M × 12 months × 5 years × ~500 bytes ≈ 3 TB.
- Short code: 7 characters of base62 gives 62⁷ ≈ 3.5 trillion codes — plenty.
3. Design
4. Key decisions
- IDs: a distributed ID generator (or pre-allocated ranges per server) encoded in base62 — no collisions, no read-before-write.
- Storage: a key-value or wide-column store keyed by short code; simple lookups, easy to shard by key.
- Caching: popular codes in Redis and at the CDN edge; most redirects never reach the database.
- Redirect:
302if you need click analytics on every visit,301if you want browsers to cache it. - Analytics: publish click events to a queue and aggregate asynchronously, off the redirect path.
Practice problems
Design a rate limiter
Review: Rate Limiting, Caching Strategies, API Gateway
Design a chat application
Review: API Architecture Styles, Message Brokers: RabbitMQ vs Kafka vs ActiveMQ, Sharding Strategies
Design a news feed
Review: Caching Strategies, Real-Time Event Streaming, SQL vs NoSQL
Design a payment system
Review: Idempotency & Preventing Double Payments, The Saga Pattern, CAP Theorem & Consistency
Design a video platform
Review: Content Delivery Networks (CDN), Message Brokers: RabbitMQ vs Kafka vs ActiveMQ, Vertical vs Horizontal Scaling
Design a multi-tenant SaaS API
Review: API Security Essentials, Sharding Strategies, Rate Limiting