System Design Q&A — Question Bank
Format: Every answer is a chain of sequential whys — from ground up, no gaps, prose over bullets. One file per question. Answers added one by one.
Part 1: Networking & Communication
- Q01 — Why does TCP exist — what problem does it solve that the raw internet doesn't? ✅
- Q02 — Why does UDP exist — when is "unreliable" actually the right choice? ✅
- Q03 — How did HTTP evolve from 1.1 → HTTP/2 → HTTP/3 — what problem does each version fix? ✅
- Q04 — Why do WebSockets exist — what does HTTP get wrong for real-time communication? ✅
- Q05 — What is long polling, and why did it exist before WebSockets? ✅
- Q06 — What is Server-Sent Events (SSE) and how does it differ from WebSockets? ✅
- Q07 — How does DNS work — what actually happens between typing a URL and a response arriving? ✅
- Q08 — What is a load balancer — why can't you just add more servers without one? ✅
Part 2: Storage Fundamentals
- Q09 — Why do databases exist — why not just use files? ✅
- Q10 — How do database indexes actually work — what is a B-tree doing physically? ✅
- Q11 — Why does a full table scan sometimes beat an index? ✅
- Q12 — What is an LSM tree — why do some databases choose it over a B-tree? ✅
- Q13 — Why do databases use write-ahead logs (WAL)? ✅
- Q14 — What does ACID really mean — not the acronym, but the actual guarantees and trade-offs? ✅
- Q15 — How does a database transaction work under the hood? ✅
- Q16 — What is connection pooling and why does it exist? ✅
Part 3: Caching
- Q17 — Why is caching hard — it's not just "store it in memory"? ✅
- Q18 — What is cache-aside, write-through, and write-behind — why does the choice matter? ✅
- Q19 — What is a cache stampede — and how do you prevent it? ✅
- Q20 — How do cache eviction policies work — LRU, LFU — and why does the choice matter? ✅
- Q21 — Why do CDNs exist — and what can they not solve? ✅
Part 4: API Design
- Q22 — Why do we paginate APIs instead of returning all results? ✅
- Q23 — What is REST and what does it actually constrain you to do? ✅
- Q24 — Why does gRPC exist — what does REST get wrong at scale? ✅
- Q25 — Why does GraphQL exist — what problem does it solve that REST doesn't? ✅
- Q26 — How do you handle idempotency for write APIs? ✅
Part 5: Reliability & Correctness
- Q27 — What is optimistic locking vs pessimistic locking — and when does each break? ✅
- Q28 — Why is distributed locking hard, and how do you do it safely? ✅
- Q29 — How do you design a retry system that doesn't destroy your own service? ✅
- Q30 — What is a circuit breaker and why does it exist? ✅
- Q31 — How does rate limiting work — and what are the failure modes of each algorithm? ✅
- Q32 — What is backpressure and why does ignoring it kill systems under load? ✅
- Q33 — What is the difference between a timeout, a deadline, and a retry budget? ✅
Part 6: Distributed Systems Core
- Q34 — What is consistent hashing — why does naive hashing break in distributed systems? ✅
- Q35 — How does replication work — and what is replication lag? ✅
- Q36 — Why do we shard databases — and what breaks when we do? ✅
- Q37 — What is eventual consistency — why does it exist and what does it cost you? ✅
- Q38 — What is strong consistency — and what does it cost you? ✅
- Q39 — What is the CAP theorem — and why is it almost always misunderstood? ✅
- Q40 — What is a distributed transaction — and why is two-phase commit (2PC) dangerous? ✅
- Q41 — How do distributed systems reach consensus — what is Raft actually solving? ✅
Part 7: Messaging & Streaming
- Q42 — Why does a message queue exist — what's wrong with direct service-to-service calls? ✅
- Q43 — What is the difference between at-most-once, at-least-once, and exactly-once delivery? ✅
- Q44 — How does Kafka work internally — why is it fast? ✅
- Q45 — What are consumer groups in Kafka — why do they exist? ✅
- Q46 — What is the difference between a queue and a pub/sub system? ✅
Part 8: Microservices & Distributed Patterns
- Q47 — Why do microservices exist — and when are they the wrong choice? ✅
- Q48 — What is service discovery — why can't services just hardcode each other's addresses? ✅
- Q49 — What is the outbox pattern — why does it exist? ✅
- Q50 — What is the saga pattern — how do you handle failures across services without 2PC? ✅
- Q51 — What is event sourcing — what do you gain and what does it cost? ✅
- Q52 — What is CQRS — why would you separate reads from writes at the architecture level? ✅
Part 9: Observability
- Q53 — What is structured logging — why does log format matter at scale? ✅
- Q54 — What is the difference between metrics, logs, and traces — when does each fail you? ✅
- Q55 — What is distributed tracing — why is a single log line not enough in microservices? ✅
Part 10: Security Fundamentals
- Q56 — Why is storing passwords as hashes not enough — what is a rainbow table attack? ✅
- Q57 — How does JWT work — and what are its real security pitfalls? ✅
- Q58 — How does OAuth 2.0 work — why does it exist instead of just passing passwords? ✅
Part 11: Advanced Data Systems
- Q59 — How does a search index work — why can't you use a database LIKE query at scale? ✅
- Q60 — How does a time-series database differ from a relational one — and why? ✅
- Q61 — How would you design a distributed ID generator (like Twitter's Snowflake)? ✅
Part 12: Applied Design Problems
- Q62 — Design a URL shortener ✅
- Q63 — Design a rate limiter from scratch ✅
- Q64 — Design a notification system (push, email, SMS at scale) ✅
- Q65 — Design a news feed / timeline (Twitter or Instagram style) ✅
- Q66 — Design a distributed cache (like Redis or Memcached) ✅
- Q67 — Design a job scheduler that runs millions of tasks reliably ✅
- Q68 — Design a real-time collaborative editing system (like Google Docs) ✅
- Q69 — Design a distributed file storage system (like S3) ✅
- Q70 — Design a search autocomplete system ✅
- Q71 — Design a live leaderboard (gaming or contests at scale) ✅
- Q72 — Design a webhook delivery system ✅