Appearance
How to Answer a Design Question
1. How should you structure a system design interview answer?
The short answer
Follow the same six steps every time, out loud. Clarify requirements: what the system must do, and how big, fast and reliable it must be. Estimate traffic and storage with rough numbers. Define the API and the main data. Draw the high-level design: clients, load balancer, services, databases, caches, queues. Go deep on the two or three hardest parts, such as the data model at scale, a hot path, or consistency. Discuss trade-offs and failures: what breaks, what you would monitor, and what you would change at ten times the load. Keep the interviewer involved at each step.
What each step sounds like, for "design a URL shortener":
| Step | You say |
|---|---|
| ① Requirements | "Create short links, redirect fast, optional custom alias and expiry. 100 million new links a month, 100 reads per write. Redirects must be very fast and highly available." |
| ② Estimates | "That is about 40 writes and 4,000 reads per second, peaks maybe 10 times. 6 billion links over 5 years at 500 bytes is about 3 TB." |
| ③ API and data | "POST /links, GET /:code. One table: code, long URL, owner, created, expiry." |
| ④ High level | "Load balancer, stateless API, key-value store, Redis cache in front, analytics through a queue." |
| ⑤ Deep dives | "How codes are generated without collisions; caching hot links; handling 400,000 reads per second at peak." |
| ⑥ Trade-offs | "301 versus 302 for analytics; what happens if the cache dies; abuse and malicious links." |
Talk while you draw. The interviewer cannot score what you are thinking. Say "I am choosing X because Y; the cost is Z".
2. How do you gather requirements and make capacity estimates?
The short answer
Split requirements into functional, what the system does, such as "users can post photos and follow others", and non-functional, how well it does it: scale, latency, availability, consistency, durability, security and cost. Ask who the users are, how many, read-to-write ratio, data size and retention, and which operations matter most. Then estimate with round numbers: daily actions ÷ 100,000 ≈ requests per second, multiply by a peak factor of 2 to 10, and items × size × retention for storage. State assumptions out loud; the interviewer wants the reasoning, not precision.
Questions worth asking, by category:
| Category | Ask |
|---|---|
| Users and scale | How many daily active users? How many actions each per day? Growth? |
| Read versus write | Is it read-heavy, like a feed, or write-heavy, like logging? |
| Latency | What must feel instant? What can take seconds? |
| Consistency | Can users see stale data? Where must it be exact, such as money? |
| Availability | What happens if it is down for a minute? |
| Data | How big is each item? How long do we keep it? |
| Scope | Which features are out of scope for today? |
The estimation trick: a day has 86,400 seconds, which is close to 100,000. So 1 million actions a day is about 10 per second, and 1 billion is about 10,000 per second.
Worked example, a photo-sharing app:
- 10 million daily users, each viewing 50 photos and uploading 0.2 per day.
- Views: 10M × 50 = 500M a day ≈ 5,000 per second; peak × 3 ≈ 15,000 per second.
- Uploads: 10M × 0.2 = 2M a day ≈ 20 per second.
- Storage: 2M photos × 2 MB = 4 TB a day, about 1.5 PB a year, before thumbnails and replicas.
- Conclusion said out loud: "Reads dominate 250 to 1, so caching and a CDN are essential; storage is the main cost, so object storage with lifecycle rules."
3. Which latency and size numbers should you know for estimates?
The short answer
Know the rough order of magnitude, not exact values. Memory access is about 100 nanoseconds; an SSD read about 100 microseconds; a round trip inside one data centre about 0.5 milliseconds; a cross-continent round trip about 100 to 150 ms. A simple Redis GET takes well under a millisecond on the network; a simple indexed database query a few milliseconds. One modern server can handle thousands of simple requests per second. For sizes: a character is a byte, a short record about 1 KB, a photo about 1 to 5 MB, a minute of HD video about 50 to 100 MB.
| Operation | Rough time |
|---|---|
| Read from main memory | 100 ns |
| Read 1 MB sequentially from memory | 10 to 50 µs |
| SSD random read | 100 µs |
| Round trip in the same data centre | 0.5 ms |
Redis GET over the network | 0.2 to 1 ms |
| Indexed database lookup | 1 to 5 ms |
| Read 1 MB from SSD | 1 ms |
| Round trip London to New York | about 70 to 80 ms |
| Round trip across the Pacific | 100 to 150 ms |
| Thing | Rough size |
|---|---|
| A user record, a tweet with metadata | 1 KB |
| A web page's HTML | 50 to 100 KB |
| A compressed photo | 1 to 5 MB |
| One minute of 1080p video | 50 to 100 MB |
| 1 billion × 1 KB | 1 TB |
Powers of two worth knowing: 2 to the power 10 is about a thousand, 2 to the 20 about a million, 2 to the 30 about a billion, 2 to the 32 about 4.3 billion, the range of a 32-bit integer.
How to use them. "Each feed load makes 20 sequential database calls at 2 ms each, so at least 40 ms before any network, which is why I would precompute the feed."
4. How do you go deep and discuss trade-offs in a design interview?
The short answer
Pick the parts that are hard for this specific problem, such as code generation for a URL shortener, fan-out for a news feed, or exactly-once charging for payments, and explain them in detail: the data model, the algorithm, the numbers, and what fails. For every choice, name the alternative and why you did not pick it, using the requirements: "I chose Cassandra over PostgreSQL here because writes are 50,000 per second and we only read by user ID; the cost is no ad-hoc queries". Then walk through failures: a node dies, a region goes down, traffic spikes tenfold, and what you would monitor.
A trade-off sentence has four parts:
- The choice: "I will precompute feeds on write."
- Why, tied to a requirement: "Reads are 100 times writes and must load in under 200 ms."
- The cost: "Celebrity posts fan out to millions of followers, which is expensive."
- The mitigation: "So for accounts with over 100,000 followers I switch to pulling their posts at read time."
Failure walkthrough checklist:
| Ask yourself | Example answer |
|---|---|
| A server dies? | Stateless, behind a load balancer; health checks remove it |
| The cache dies? | Requests fall back to the database with a concurrency limit; warm the cache |
| The database primary dies? | Automatic failover to a synchronous replica; a few seconds of write errors |
| A region goes down? | Second region, DNS failover; we accept losing the last seconds of async writes |
| Traffic goes up 10 times? | Autoscale stateless parts; shed non-critical load; queue writes |
| A message is delivered twice? | Idempotent consumers keyed by message ID |
Signals interviewers score: you asked clarifying questions, you used numbers, you chose simple first and scaled when needed, you named costs, and you thought about failure and operations. The patterns behind most answers are on the next page.