{}DSA Atlas

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.

Intermediate5 interview questions

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.

Requirements5–8 min Estimate3–5 API3–5 Data3–5 High-level design~10 min Deep dives & trade-offs15–20 min Wrap3–5 spend the most time where the hard problems are — not on boilerplate boxes
A 45-minute budget. Scale proportionally for 60 minutes.

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

CategoryQuestions to ask
ScaleDAU/MAU? requests per day? data volume and growth?
Read/write ratioread-heavy (feeds, URL redirects) or write-heavy (logging, IoT)?
Latencyp50/p99 targets for the key operations?
Availability99.9% or 99.99%? any operation that can be unavailable?
Consistencymust reads see the latest write? which data tolerates staleness?
Durabilitycan we ever lose data?
Geographysingle region or global? data residency?
Security / privacyauth, PII, compliance (PCI, GDPR, HIPAA, DPDP)?
Costany constraints?

Step 2: Back-of-the-envelope estimation

Numbers to memorise

UnitValue
Seconds per day86,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 factor2–10× average (use 2–3× unless spiky)

Powers of two

PowerExactApproxName
2¹⁰1,02410³1 KB
2²⁰1,048,57610⁶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)

OperationTime
L1 cache reference1 ns
Branch mispredict3 ns
L2 cache reference4 ns
Mutex lock/unlock (uncontended)20 ns
Main memory reference100 ns
Compress 1 KB (Snappy/LZ4)2 µs
Read 1 MB sequentially from memory3 µs
NVMe SSD random 4 KB read20–100 µs
Round trip in the same datacenter500 µs
Read 1 MB sequentially from NVMe100–300 µs
HDD seek5–10 ms
Read 1 MB sequentially from HDD5 ms
Round trip US East ↔ US West60–70 ms
Round trip US ↔ Europe80–100 ms
Round trip US ↔ India / Australia200+ ms

Typical capacities (rough planning numbers)

ComponentBallpark 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 card10–25 Gbit/s (≈ 1–3 GB/s)

The estimation recipe

  1. Users: DAU (and how many actions each).
  2. QPS = DAU × actions per user per day / 86,400; peak = ×2–3.
  3. Storage = items per day × size per item × retention × replication.
  4. Bandwidth = QPS × payload size (ingress and egress separately).
  5. Servers / shards = load / per-node capacity (+ headroom, + redundancy).
  6. 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.

QuantityCalculationResult
Uploads/s100M × 0.2 / 86,400≈ 230/s (peak ~700/s)
Views/s100M × 50 / 86,400≈ 58k/s (peak ~150k/s)
Read:write58k : 230≈ 250 : 1
New storage/day20M × 2.2 MB≈ 44 TB/day
Storage/year44 TB × 365≈ 16 PB/year (object storage, tiering)
Egress58k/s × ~200 KB (most views are thumbnails/feed sizes)≈ 11.6 GB/s → must be served by a CDN
Metadata20M 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:

Text
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

LevelExpectation
Junior / new gradsensible components, clear API and data model, basic scaling ideas (cache, LB, replicas)
Midquantified design, correct storage choices, caching/queue patterns, failure handling, trade-offs
Seniordrives 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

0 / 5 marked confident

Answer out loud first, then open the model answer. Mark a question confident only when you could explain it to an interviewer without notes.