The Interview Framework & Back-of-the-Envelope Estimation
A minute-by-minute framework for 45–60 minute system design interviews, how to gather functional and non-functional requirements, latency numbers and powers of two, QPS/storage/bandwidth/server estimation with fully worked examples, and what interviewers look for at each level.
Why a framework?
System design prompts are deliberately vague. A framework keeps you from (a) drawing boxes before you know what you're building, (b) running out of time before the interesting parts, and (c) forgetting non-functional requirements — the part interviewers care most about.
Step 1: Requirements
Functional requirements
List the core features (3–5), confirm them, and explicitly park the rest.
Design a URL shortener → (1) create a short URL for a long URL, optional custom alias and expiry; (2) redirect short → long; (3) basic click analytics. Out of scope: user accounts UI, link editing, spam scanning (mention as an extension).
Non-functional requirements
| Category | Questions to ask |
|---|---|
| Scale | DAU/MAU? requests per day? data volume and growth? |
| Read/write ratio | read-heavy (feeds, URL redirects) or write-heavy (logging, IoT)? |
| Latency | p50/p99 targets for the key operations? |
| Availability | 99.9% or 99.99%? any operation that can be unavailable? |
| Consistency | must reads see the latest write? which data tolerates staleness? |
| Durability | can we ever lose data? |
| Geography | single region or global? data residency? |
| Security / privacy | auth, PII, compliance (PCI, GDPR, HIPAA, DPDP)? |
| Cost | any constraints? |
Step 2: Back-of-the-envelope estimation
Numbers to memorise
| Unit | Value |
|---|---|
| Seconds per day | 86,400 ≈ 10⁵ (use 100k for quick math) |
| Seconds per month | ≈ 2.5 × 10⁶ |
| 1 million requests/day | ≈ 12 QPS |
| 1 billion requests/day | ≈ 12k QPS |
| Peak factor | 2–10× average (use 2–3× unless spiky) |
Powers of two
| Power | Exact | Approx | Name |
|---|---|---|---|
| 2¹⁰ | 1,024 | 10³ | 1 KB |
| 2²⁰ | 1,048,576 | 10⁶ | 1 MB |
| 2³⁰ | ≈ 1.07 × 10⁹ | 10⁹ | 1 GB |
| 2⁴⁰ | ≈ 1.1 × 10¹² | 10¹² | 1 TB |
| 2⁵⁰ | ≈ 1.13 × 10¹⁵ | 10¹⁵ | 1 PB |
Latency numbers (orders of magnitude)
| Operation | Time |
|---|---|
| L1 cache reference | 1 ns |
| Branch mispredict | 3 ns |
| L2 cache reference | 4 ns |
| Mutex lock/unlock (uncontended) | 20 ns |
| Main memory reference | 100 ns |
| Compress 1 KB (Snappy/LZ4) | 2 µs |
| Read 1 MB sequentially from memory | 3 µs |
| NVMe SSD random 4 KB read | 20–100 µs |
| Round trip in the same datacenter | 500 µs |
| Read 1 MB sequentially from NVMe | 100–300 µs |
| HDD seek | 5–10 ms |
| Read 1 MB sequentially from HDD | 5 ms |
| Round trip US East ↔ US West | 60–70 ms |
| Round trip US ↔ Europe | 80–100 ms |
| Round trip US ↔ India / Australia | 200+ ms |
Typical capacities (rough planning numbers)
| Component | Ballpark per node |
|---|---|
| Web/app server (simple JSON API) | 1k–10k QPS (depends heavily on work per request) |
| Redis (single shard) | 100k+ ops/s, sub-ms |
| Postgres/MySQL (well-indexed OLTP, decent hardware) | 10k–50k simple QPS; writes lower |
| Kafka partition | ~10 MB/s write; a broker 100s of MB/s |
| Cassandra node | ~10k+ writes/s |
| Network card | 10–25 Gbit/s (≈ 1–3 GB/s) |
The estimation recipe
- Users: DAU (and how many actions each).
- QPS = DAU × actions per user per day / 86,400; peak = ×2–3.
- Storage = items per day × size per item × retention × replication.
- Bandwidth = QPS × payload size (ingress and egress separately).
- Servers / shards = load / per-node capacity (+ headroom, + redundancy).
- Cache size = hot fraction of data (often 20% of daily reads, the 80/20 rule).
Worked example: a photo-sharing app
100M DAU; each user uploads 0.2 photos/day and views 50 photos/day. Average photo 2 MB (original) + thumbnails 200 KB. Keep forever.
| Quantity | Calculation | Result |
|---|---|---|
| Uploads/s | 100M × 0.2 / 86,400 | ≈ 230/s (peak ~700/s) |
| Views/s | 100M × 50 / 86,400 | ≈ 58k/s (peak ~150k/s) |
| Read:write | 58k : 230 | ≈ 250 : 1 |
| New storage/day | 20M × 2.2 MB | ≈ 44 TB/day |
| Storage/year | 44 TB × 365 | ≈ 16 PB/year (object storage, tiering) |
| Egress | 58k/s × ~200 KB (most views are thumbnails/feed sizes) | ≈ 11.6 GB/s → must be served by a CDN |
| Metadata | 20M rows/day × 500 B | ≈ 10 GB/day → easily a sharded DB |
Conclusions the numbers force: object storage + CDN for images, direct-to-storage uploads with pre-signed URLs, metadata in a database (sharded by user or photo id), aggressive caching for feeds, async processing for thumbnails.
Step 3: API design
Write the 3–6 most important endpoints (or events) with key parameters and responses:
POST /v1/urls {long_url, custom_alias?, expires_at?} → 201 {short_url}
GET /{code} → 301/302 Location: long_url
GET /v1/urls/{code}/stats → {clicks, by_day[], top_referrers[]}
Mention auth, pagination, idempotency keys and rate limits briefly.
Step 4: Data model
- Entities and access patterns ("look up URL by code" — point read by key; "stats by code and day" — range read).
- Choose stores per pattern; justify (see Choosing a database).
- Sketch key tables with primary keys / partition keys.
Step 5: High-level design
Draw the request path for each functional requirement: clients → CDN/LB → services → caches/DBs/queues → async workers. Keep it simple first; then iterate.
Step 6: Deep dives
Typical topics: the hottest path's scaling (caching, sharding, replicas), data partitioning and hot keys, consistency choices, fan-out strategies, idempotency and exactly-once effects, failure scenarios ("what if the cache dies?", "a region goes down?"), and specific algorithms (ID generation, ranking, geo search).
Step 7: Wrap-up
Summarise, then volunteer: bottlenecks and how to remove them, monitoring/alerting (key metrics), failure handling, security/privacy, cost levers, and future features.
What interviewers look for by level
| Level | Expectation |
|---|---|
| Junior / new grad | sensible components, clear API and data model, basic scaling ideas (cache, LB, replicas) |
| Mid | quantified design, correct storage choices, caching/queue patterns, failure handling, trade-offs |
| Senior | drives the conversation, identifies the real bottlenecks quickly, deep dives on consistency/partitioning/hot spots, operability and evolution |
| Staff+ | multiple viable architectures compared, organisational/operational/cost trade-offs, migration paths, risk management |
Common mistakes
- Designing before clarifying requirements and scale.
- Ignoring NFRs (availability, consistency, latency).
- Over-engineering early (Kafka + microservices + Kubernetes for 1k users).
- Hand-waving the data model and the hard parts ("we'll just use a cache").
- Not quantifying ("a lot of traffic").
- Single points of failure left unaddressed.
- Monologuing: check in with the interviewer at each step.
Interview questions
Answer out loud first, then open the model answer. Mark a question confident only when you could explain it to an interviewer without notes.