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:

1 ยท Requirements

Do you ask before you build?

2 ยท Estimation

Do you know roughly how big things are?

3 ยท High-level design

Can you draw a sane v1?

4 ยท Deep dives

Can you go deep on one or two components?

5 ยท Tradeoffs

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.

Your unfair advantage: you can answer almost every follow-up with "here's what we actually do in production." Use it constantly. "In my current system, we solved this with X because Y" is the strongest sentence you can say in these interviews.

ยง2The 6-Phase Framework 45-min round

Phase 1 ยท Requirements 5 min

Clarify functional + non-functional. Output: a scoped problem with an explicit out-of-scope list.

Phase 2 ยท Estimation 3โ€“5 min

Back-of-envelope QPS, storage, bandwidth. Output: numbers that drive design.

Phase 3 ยท API design 3โ€“5 min

3โ€“6 endpoints with method, path, request, response, auth.

Phase 4 ยท High-level design 10 min

Boxes + arrows: LB โ†’ stateless API โ†’ cache/DB โ†’ queue โ†’ workers.

Phase 5 ยท Deep dives 12โ€“15 min

Go three levels down on 2 components โ€” the biggest scoring block.

Phase 6 ยท Wrap-up 3โ€“5 min

Tradeoffs, failure modes, "what breaks first," what changes at 10x.

Do not let any phase eat the next one. If requirements are taking 10 minutes, say: "Let me lock scope here and move to the design โ€” we can revisit if needed."

ยง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:

NFRThe question to askWhy 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
Map to your experience: you already make these calls daily. Your billing pipeline for 50+ enterprise clients cannot lose a usage event (durability, consistency); your search/event pipeline into OpenSearch tolerates seconds of ingestion lag (eventual consistency, throughput over latency). Say it: "In my platform, billing events and search events have completely different consistency needs, so we treat them differently โ€” I'd apply the same split here."

ยง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 / trafficValue
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"
StorageValue
1 char1 byte ยท 1 KB = 103 B ยท 1 MB = 106 B ยท 1 GB = 109 B ยท 1 TB = 1012 B
Typical row/record100 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
Rule: memory is ~1000x faster than disk; same-DC network is ~100x faster than cross-region. Cache hits save you 1โ€“2 orders of magnitude.
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

"My LLM API platform does 2M+ requests/month. That's 2ร—106 / (30 ร— 86,400) โ‰ˆ 0.8 QPS average, maybe 5โ€“10 QPS peak. That's why a handful of gateway replicas handle it easily, and why our engineering effort goes into per-request cost and latency (LLM calls are expensive and slow) rather than raw QPS."

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.
Conclusion to say out loud: "Write load is tiny; read load is modest. This is a read-heavy system โ†’ cache the hot redirects, replicate reads, and the DB is not the bottleneck." That last sentence is the whole point of estimation: derive a design implication, don't just produce numbers.

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.

๐Ÿงฎ Back-of-Envelope Calculator

Change the assumptions, watch the arithmetic. The formulas are the point โ€” this is exactly the mental math you do at the whiteboard.





QuantityResultThe arithmetic (learn this)
Avg write QPSโ€“
Avg read QPSโ€“
Peak QPS (ร—3 rule)โ€“
Storage / dayโ€“
Storage / 5 yearsโ€“

โ€“

ยง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."

Then ask: "Which part would you like me to go deeper on?" โ€” this hands the interviewer the wheel and shows collaboration. If they say "your choice," pick the component where you're strongest (data model, queue, or cache).

ยง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):

1 ยท API gateway

Auth, per-tenant rate limiting, billing metering โ€” your Kong setup.

2 ยท Kafka consumption

Partitions, consumer groups, offset management, batching into a sink โ€” your OpenSearch pipeline.

3 ยท Latency debugging

Distributed tracing methodology โ€” your 71sโ†’2s story.

4 ยท Caching

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."

The trap to avoid at your level: jumping to exotic tech to sound impressive. Saying "I'd use Cassandra" without being able to explain partition keys is worse than saying "Postgres with read replicas, and here's exactly when it stops being enough." Your production credibility is Postgres, Redis, Kafka, Kong, Kubernetes, OpenSearch โ€” design with the tools you can defend three questions deep.

ยง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?