03 ยท System Design โ 01
How to Approach a System Design Interview
You already run production systems: an LLM-serving platform doing 2M+ requests/month behind Kong on Kubernetes, Kafka pipelines feeding OpenSearch for 5,000+ concurrent users across 20+ microservices. The interview is not about learning new material โ it is about packaging what you already operate into a structured 40-minute conversation. This page gives you that structure.
ยง1The Core Insight
A system design interview is not a test of whether you can invent Twitter. It is a test of five things:
Do you ask before you build?
Do you know roughly how big things are?
Can you draw a sane v1?
Can you go deep on one or two components?
Do you know that every choice costs something?
At SDE-1/2 level, interviewers are checking for structured thinking + fundamentals. They are NOT expecting a globally-replicated multi-region design from scratch. A candidate who builds a clean single-region design and articulates why each piece exists beats a candidate who name-drops "Cassandra, CRDTs, cell-based architecture" without justification.
ยง2The 6-Phase Framework 45-min round
Clarify functional + non-functional. Output: a scoped problem with an explicit out-of-scope list.
Back-of-envelope QPS, storage, bandwidth. Output: numbers that drive design.
3โ6 endpoints with method, path, request, response, auth.
Boxes + arrows: LB โ stateless API โ cache/DB โ queue โ workers.
Go three levels down on 2 components โ the biggest scoring block.
Tradeoffs, failure modes, "what breaks first," what changes at 10x.
ยง3Phase 1: Requirements Clarification
Split into functional and non-functional. Say those exact words โ it signals structure immediately.
Functional requirements (what the system does)
Ask 3โ5 questions max. Good patterns:
- "Who are the users and what are the top 2โ3 actions they take?"
- "Do we need X?" (for a URL shortener: custom aliases? expiry? analytics?)
- "Is this read-heavy or write-heavy?" โ always ask this; it drives everything downstream
- "What's explicitly OUT of scope?" โ then write the out-of-scope list down. Interviewers love this.
Non-functional requirements (how well it does it)
Cover these five. You don't need all of them every time, but touch each:
| NFR | The question to ask | Why it matters |
|---|---|---|
| Scale | "How many users / requests per day?" | Drives estimation |
| Latency | "What's acceptable p99? Is this user-facing?" | Sync vs async, caching |
| Availability | "Is 99.9% fine, or is this payments-grade?" | Replication, failover |
| Consistency | "Can reads be slightly stale?" | SQL vs NoSQL, cache strategy |
| Durability | "Can we ever lose a write?" | Sync replication, WAL, queues |
ยง4Phase 2: Back-of-Envelope Estimation
The goal is NOT precision. It is showing you can reason in powers of ten and let the numbers drive design decisions ("100 QPS โ one Postgres box is fine; 100K QPS โ we need to talk about sharding and caching").
Numbers to memorize โ the only tables you need
| Time / traffic | Value |
|---|---|
| 1 day | โ 86,400 s โ round to 100,000 s (105) for mental math |
| 1 million requests/day | โ 12 QPS (~10 QPS) |
| 100 million requests/day | โ 1,200 QPS (~1K QPS) |
| Peak traffic | โ 2โ5x average โ say "I'll assume 3x peak" |
| Storage | Value |
|---|---|
| 1 char | 1 byte ยท 1 KB = 103 B ยท 1 MB = 106 B ยท 1 GB = 109 B ยท 1 TB = 1012 B |
| Typical row/record | 100 B โ 1 KB |
| Tweet-ish object | ~300 B |
| Image | ~200 KB โ 1 MB |
| Video minute | ~50 MB |
| Latency (the "Jeff Dean numbers", rounded) | Order of magnitude |
|---|---|
| L1 cache reference | ~1 ns |
| Main memory reference | ~100 ns |
| Redis GET (same DC) | ~0.2โ0.5 ms |
| SSD random read | ~0.1โ0.2 ms |
| Intra-datacenter RTT | ~0.5 ms |
| Postgres indexed read | ~1โ5 ms |
| Disk seek (HDD) | ~10 ms |
| Cross-region RTT (e.g. INโUS) | ~150โ250 ms |
| Throughput sanity checks (single node, rough) | Value |
|---|---|
| Postgres | ~5Kโ20K simple TPS |
| Redis | ~100K ops/s |
| Kafka broker | ~100s of MB/s; millions of msgs/s per cluster |
| Well-built stateless API pod | ~1Kโ10K RPS |
Worked example 1 โ your own platform as calibration
Knowing your own system's numbers cold is a credibility multiplier. Interviewers ask "what scale have you worked with?" โ answer precisely.
Worked example 2 โ URL shortener (the classic)
Assume: 100M new URLs/month, 10:1 read:write
Writes: 10^8 / month โ 10^8 / (2.5ร10^6 s) โ 40 writes/s
Reads: 400 reads/s average, ~1,200/s peak (3x)
Storage: 100M/month ร 500 B/record (short code, long URL, metadata)
= 5ร10^10 B/month = 50 GB/month = 600 GB/year, ~3 TB over 5 yrs
โ fits on one big DB with replicas; sharding optional, not urgent
Bandwidth: 1,200 QPS ร 500 B โ 600 KB/s โ trivial.
Worked example 3 โ event pipeline
Assume: 5,000 concurrent users, each generating 2 events/s
โ 10,000 events/s into the pipeline
Each event ~1 KB โ 10 MB/s ingest โ comfortable for one Kafka
cluster, but 10K individual OpenSearch writes/s would strangle it
โ batch (e.g. bulk index every 1s or every 5K docs).
This is literally your production architecture โ you built batched OpenSearch ingestion for exactly this reason. Say so.
ยง5Phase 3: API Design
Keep it tight: 3โ6 endpoints, REST unless there's a reason (streaming โ SSE/WebSocket; internal service-to-service โ gRPC is a fine mention). For each endpoint state: method, path, request, response, and auth.
POST /api/v1/urls
body: { "long_url": "...", "custom_alias": "?", "expires_at": "?" }
resp: 201 { "short_url": "https://sho.rt/Ab3xK9" }
auth: API key / JWT
GET /{code} โ 302 Location: <long_url> (301 vs 302: discuss caching!)
Things that mark you as someone who runs real APIs (sprinkle 2โ3 in):
- Idempotency keys on any write that money or side effects depend on ("we do this for billing events โ client sends
Idempotency-Key, we dedupe server-side"). - Pagination on list endpoints (cursor-based > offset for large sets).
- Rate limiting headers (
429,Retry-After,X-RateLimit-Remaining) โ you built per-tenant rate limiting on Kong; this is home turf. - Versioning (
/v1/) and auth model (API key per tenant vs user JWT).
ยง6Phase 4: High-Level Design
Draw the boring, correct v1 first. Almost every system starts as:
+-----------+
clients ---> | LB | ---> [ API service ] x N (stateless)
+-----------+ | |
| +-----> [ Cache (Redis) ]
v
[ Database ] (primary + replicas)
|
+-----> [ Queue (Kafka) ] --> [ Workers ]
|
v
[ Search / Analytics ]
Narrate left to right: entry point โ compute โ data โ async. For every box, say why it exists in one sentence. "Stateless API tier so we can scale horizontally and any pod can serve any request โ this is how our services run on Kubernetes behind Kong."
ยง7Phase 5: Deep Dives
Pick 1โ2 components and go three levels down. A deep dive means covering, for that component:
- Data model / schema โ actual columns/keys, indexes
- The hard problem โ hot keys, ordering, exactly-once, thundering herd, cache invalidation
- Failure mode โ what happens when this box dies; how we detect and recover
- The scaling story โ what changes at 10x
Your strongest deep-dive territories (rehearse these โ details in files 02, 03, 05, 06):
Auth, per-tenant rate limiting, billing metering โ your Kong setup.
Partitions, consumer groups, offset management, batching into a sink โ your OpenSearch pipeline.
Distributed tracing methodology โ your 71sโ2s story.
Redis patterns, invalidation, TTLs.
ยง8Phase 6: Wrap-Up โ Tradeoffs and Failure Talk
Close with 2โ3 of these, unprompted:
- "Single points of failure: the LB and the DB primary โ here's how each fails over."
- "What I'd cut for v1 vs what I'd add at 10x scale."
- "The main tradeoff I made: I chose eventual consistency on reads to get X โ if the product needed strong consistency, I'd change Y."
- "How I'd know it's healthy: the 2โ3 metrics I'd put on a dashboard" (p99 latency, error rate, queue lag โ you live in these).
ยง9The First 5 Minutes โ A Script
Memorize the skeleton, improvise the content.
"Great โ before I design anything, let me make sure I understand the problem. I'll spend a couple of minutes on requirements, do quick capacity estimates, then sketch the API and high-level design, and we can deep-dive wherever you find interesting. Sound good?
Functionally: the core flows are [A], [B], and [C] โ is that right? Do we need [likely feature]? I'll explicitly leave [X, Y] out of scope for now.
Non-functionally: roughly how many users / requests per day should I design for? Is this read-heavy or write-heavy? What matters more here โ latency or consistency? And what's the availability bar โ is 99.9% fine?
OK. Summarizing: we're building [one-sentence scope] for [scale], optimizing for [read latency / write durability / whatever]. Let me do quick numbers to see what that impliesโฆ"
Why this works: in 90 seconds you've (a) shown a plan for the whole interview, (b) taken control of scope, (c) asked the read/write question that drives everything, and (d) created a checkpoint the interviewer can correct. Nothing you say later can be "wrong scope" โ you negotiated it.
ยง10SDE-1/2 Expectations vs Senior โ Calibrate Your Ambition
SDE-1/2 interviewers are scoring
- Structured approach (the framework above, executed without prompting)
- Correct fundamentals: knows what a load balancer, cache, queue, index, and replica actually do
- Sensible v1 design that would genuinely work
- Can go deep on at least one component when pushed
- Recognizes tradeoffs when pointed at them; ideally raises one or two unprompted
- Communicates clearly, takes hints, collaborates
NOT expected at SDE-1/2 (don't force it)
- Multi-region active-active, cell-based architecture, custom consensus protocols
- Inventing novel solutions to open problems
- Capacity planning to the exact node count
- Driving the entire interview with zero interviewer input
What separates a strong SDE-2 answer from a senior answer (so you know where the ceiling is): seniors are expected to drive ambiguity resolution themselves, weigh org-level concerns (team boundaries, migration paths, cost), and proactively design for failure domains. You get significant credit for merely gesturing at these: "at bigger scale I'd consider splitting this into its own service โ similar to how our platform runs 20+ microservices with the gateway as the seam."
ยง11Probe Questions & Self-Test
Q: The interviewer says "design for 1 million requests per day." What's the QPS, and what does it imply?
1M/day โ 12 QPS average (106 / 86,400), maybe ~36 QPS at 3x peak. Implication: this is tiny โ one Postgres box and a couple of stateless API pods handle it. Say that out loud, then spend your effort on latency, durability, or whatever NFR actually matters, not sharding.
Q: What is the ONE question you must ask in the first 3 minutes, and why?
"Is this read-heavy or write-heavy?" It drives everything downstream: caching strategy, replication (read replicas vs write sharding), SQL vs NoSQL, sync vs async writes, and where the bottleneck will be.
Q: Name the five non-functional requirements and one design lever each maps to.
Scale โ estimation and horizontal scaling. Latency โ sync vs async, caching. Availability โ replication, failover. Consistency โ SQL vs NoSQL, cache strategy. Durability โ sync replication, WAL, queues. Bonus framing: billing events need durability + consistency; search-ingest events tolerate lag โ treat them differently.
Q: Walk the URL-shortener estimate: 100M new URLs/month, 10:1 read:write. End with a design implication.
Writes: 108 / 2.5ร106 s โ 40 writes/s. Reads: 400/s avg, ~1,200/s peak (3x). Storage: 100M ร 500 B โ 50 GB/month โ ~3 TB over 5 years โ one big DB with replicas is fine. Bandwidth: 1,200 ร 500 B โ 600 KB/s, trivial. Implication: "read-heavy system โ cache the hot redirects, replicate reads, DB is not the bottleneck."
Q: Requirements discussion has eaten 10 minutes. What do you say?
"Let me lock scope here and move to the design โ we can revisit if needed." Time-boxing yourself out loud is itself a signal: you manage the 45 minutes like you'd manage an incident call.
Q: You finish the high-level diagram. What's the exact next sentence?
"Which part would you like me to go deeper on?" It hands the interviewer the wheel and shows collaboration. If they say "your choice," pick your strongest territory: gateway, Kafka consumption, tracing, or caching.
Quick self-check before any round (open and answer honestly)
- Can I recite the 6 phases and time budget?
- Can I do the "1M/day โ 12 QPS" conversions instantly?
- Do I know MY OWN systems' numbers? (2M+ req/month โ ~1 QPS avg; 5K concurrent users; 50+ tenants; 20+ services; 71sโ2s)
- Do I have my 4 rehearsed deep dives ready? (gateway, Kafka, tracing, caching)
- Will I ask "read-heavy or write-heavy?" in the first 3 minutes?