Lesson Overview + Section #01 + RESHADED Checklist + Quiz #1 are unlocked free below (no login required). Unlock all 80 HD video lessons and deep-dive sections — or watch our two free sample video lessons first.
WhatsApp delivers ~100 billion messages/day across 2 billion active mobile users (~1.16 million messages/s average) with sub-second push latency, strict per-conversation ordering, exact-once user-visible delivery, 30-day offline persistence, and end-to-end encryption (E2EE). Unlike cloud-archived workspaces, WhatsApp operates as a stateful transient delivery relay—holding millions of persistent WebSocket connections open while persisting undelivered ciphertext only until acknowledged by the recipient device. L4-L6 interviewers evaluate stateful gateway sizing, sub-millisecond session routing in Redis, decoupling heavy media and group fan-out from real-time chat sockets, and handling reconnect storms when multi-million-socket gateways fail.
WHAT YOU WILL MASTER IN THIS LESSON
Size a stateful C10M-class WebSocket fleet (200 gateways at 10M open connections/server), daily text ingress (10 TB/day, 926 Mbps), and 30-day offline storage buffers (300 TB).
Architect sub-millisecond cross-gateway message routing using a Redis-backed WebSocket Manager paired with replicated Mnesia store-and-forward persistence and APNs/FCM wakeups.
Offload 2 MB+ encrypted media payloads onto an HTTP Asset Service, content-addressed Blob Store, and edge CDN while keeping WebSocket chat frames around ~100 bytes.
Preserve total per-chat ordering and exact-once semantics via monotonic sequence numbers, hop-by-hop acknowledgements, per-group Kafka topics, and jittered crash reconnection.
Follow this exact sequence from the Intro narration on every system design prompt so you never miss requirements, math, contracts, or the 13-minute deep dive.
0 / 8 Checked
RRequirements & ScopeMin 2–8
Clarify who the users are, 3–4 core functional flows, explicit non-goals, and target latency/availability SLAs before drawing a single box.
Avoid trap: Still gathering requirements at minute 15 squeezes the deep dive where L5/L6 offers are decided.
EBack-of-the-Envelope MathMin 8–12
Compute ONLY numbers that actively change architectural choices: DAU → peak read/write RPS, daily & 5-year storage, bandwidth (or tokens/sec & KV-cache VRAM for AI).
Avoid trap: Spending 10 minutes multiplying irrelevant byte counts that never influence sharding or caching.
SStorage & Data ModelMin 12–15
Define core tables, primary/partition keys, and access indexes. Separate small structured metadata rows (~1 KB) from bulk binary blobs (S3 + CDN).
Avoid trap: Picking Cassandra or NoSQL by buzzword when 40 writes/s & 3 TB fit cleanly on one indexed SQL primary + replicas.
AAPIs & Wire ContractsMin 15–17
Write 3–4 concrete REST/gRPC/SSE/WebSocket endpoints with request/response shapes, cursor pagination, and Idempotency-Key headers on mutations.
Avoid trap: Hand-waving client-server contracts and discovering missing parameters halfway through the deep dive.
HHigh-Level DesignMin 17–27
Draw the simplest end-to-end working read and write paths first. Every box on the board must trace back to a stated requirement or number.
Avoid trap: Reciting a memorized 12-microservice Kafka mesh before proving why a simpler synchronous path breaks.
DDetailed Design (Deep Dive)Min 27–36
Proactively audit your high-level diagram, name the top 2 bottlenecks (hot partitions, fan-out skew, lock contention, GPU saturation), and go deep on internals.
Avoid trap: Waiting passively for the interviewer to rescue pacing or skimming every box at shallow surface depth.
EEvaluation & Failure ModesMin 36–41
State what each architectural choice COSTS you, and trace graceful degradation when cache, queue, external vendor, or primary DB fails.
Avoid trap: Assuming happy-path uptime or placing slow 3-second external calls inline on revenue-critical write paths.
DDistinctive FeatureMin 41–45
Solve the signature hard problem unique to this prompt (e.g., double-entry ledger idempotency, Geohash dispatch locks, OT/CRDT sync, or SSE token streaming).
Avoid trap: Spending 20 minutes on generic login/CRUD tables and zero time on the core distributed challenge.
INTERVIEWER SCORECARD · WHAT MAKES A STRONG HIRE?
5 Signals Bar Raisers Grade (L4 vs. L5 Senior vs. L6 Staff)
Senior (L5 / E5 / Senior SDE) Bar — Autonomous Pacing, Depth & Proactive Trade-Offs: Owns the 45-minute clock without prompting, derives every component quantitatively, surfaces failure modes (hot shards, stampedes, dual writes) BEFORE being asked, and defends consistency vs. latency trade-offs.
1. Scoping
✓ STRONG HIRE SIGNAL
Clarifies users, read/write skew, p99 latency, consistency bounds, and explicit non-goals in minutes 2–8.
✗ NO-HIRE RED FLAG
Jumps straight into drawing load balancers and microservices at minute 2 without asking a single question.
2. Right-Sized Design
✓ STRONG HIRE SIGNAL
Starts with the simplest working architecture justified by the math (e.g., 1 NVMe SQL primary + replicas + Redis for 40 writes/s & 3 TB).
✗ NO-HIRE RED FLAG
Recites a memorized Kafka + multi-DC Cassandra diagram that contradicts their own traffic calculations.
3. Technical Depth
✓ STRONG HIRE SIGNAL
Drives deep into 1–2 hard bottlenecks (partition keys, hot-key mitigation, transactional outbox, KV-cache batching) at minute 27.
✗ NO-HIRE RED FLAG
Skims across 12 boxes at identical buzzword depth and runs out of time before the deep dive.
4. Explicit Trade-Offs
✓ STRONG HIRE SIGNAL
Uses 3-part reasoning: 'A queue here because SMTP spikes to 3 s; checkout stays <60 ms, and we accept eventual email delay + retry dedup.'
✗ NO-HIRE RED FLAG
Name-drops tools ('We put Kafka and ZooKeeper here') without stating the alternative or operational cost.
5. Communication
✓ STRONG HIRE SIGNAL
Thinks aloud every 30–45s, checks alignment at phase transitions, and treats 'What if X fails?' as a cue for where points are awarded.
✗ NO-HIRE RED FLAG
Goes silent for 5 minutes while drawing or defends a flawed assumption defensively when nudged.
ARCHITECTURE & DATA-FLOW SLIDES · SLIDE 1 OF 1Section 01: System Design: WhatsApp
ARCHITECTURE / DATA FLOW DIAGRAM
SECTION 01 OF 5
1. System Design: WhatsApp
★ FREE PREVIEW
Key Takeaway: Mobile devices behind NAT and intermittent cellular networks cannot message peer-to-peer reliably; WhatsApp solves planetary-scale delivery with two invariants: keep long-lived sockets open to online devices and store every message durably until the receiver acknowledges it.
ARCHITECTURE / DATA FLOW DIAGRAM
Why Mediated Store-and-Forward Replaces Peer-to-Peer on Mobile
Direct phone-to-phone TCP communication fails across mobile networks because carrier-grade NAT (CGNAT) hides client IP addresses, cellular handoffs continuously rotate ephemeral endpoints, and mobile operating systems suspend background apps or lose signal entirely on flights and dead batteries. Placing a server tier between Asha and Ben decouples sender availability from receiver reachability: Asha uploads a message once over her active connection, and the server either pushes it immediately down Ben's open socket or holds it safely until Ben reconnects, propagating Sent, Delivered, and Read state transitions back to Asha.
Scale Amplification: 2,000,000,000 active users exchange ~100,000,000,000 messages/day (~1.16M msgs/s steady state), turning socket state management and cross-server routing into the primary bottleneck.
Ordering & Idempotency: If Asha sends "hi" followed by "how are you" over a flaky 4G link that triggers retries, Ben must observe each message exactly once and strictly in causal send order.
Workload Heterogeneity: 2 MB photos (20,000x larger than a 100-byte text message) and N-member group chats require isolated storage and fan-out paths so they never stall 1-to-1 text sockets.
Transient Delivery Relay vs. Permanent Cloud Archive
A foundational architectural decision separates WhatsApp from Slack or Telegram cloud chats: WhatsApp servers act strictly as a transient delivery relay rather than a permanent history database. Once Ben's phone acknowledges receipt of a message, the server deletes its copy immediately—bounding server-side message retention to a 30-day offline window, minimizing storage footprint by orders of magnitude, and aligning naturally with device-only End-to-End Encryption (E2EE) where servers hold zero plaintext or long-term message archives.
Architectural Dimension
Naive / Stateless Approach
WhatsApp Core Principle
Client-server transport
Stateless HTTP polling drains radio battery and adds multi-second lag
Long-lived bidirectional WebSocket per online phone with tiny heartbeats
Server storage lifecycle
Retain all historical messages forever (multi-PB/year growth)
Store-until-acked in replicated Mnesia; evict on ACK or after 30-day offline TTL
Binary media attachments
Stream megabyte blobs over chat WebSockets (head-of-line blocking)
Upload encrypted blob via HTTPS to Blob Store + CDN; send tiny file_id on socket
Group chat delivery
Synchronous N-way loop inside sender's chat server
Single append to per-group Kafka log + asynchronous Group Handler fan-out
Interview Signal: Clarify history retention in the first 2 minutes of an interview: transient store-and-forward (delete on ACK) keeps working sets tiny enough for low-latency replicated RAM/SSD stores like Mnesia, whereas multi-device permanent history requires wide-column stores like Cassandra/ScyllaDB partitioned by (chat_id, bucket_id).
SECTION 02 OF 5
2. Requirements of WhatsApp's Design
🔒 PRO SECTION
Key Takeaway: Text payloads require modest bandwidth (926 Mbps) and bounded 30-day offline storage (300 TB), whereas holding 2 billion open connections drives server fleet sizing (~200 high-concurrency gateways) under a strict CP-over-AP ordering guarantee.
Section 1 + Checkpoint Quiz #1 are unlocked free outside the paywall. Unlock all architecture slides, QPS & sharding trade-off tables, and all 80 narrated HD video lessons with Full Access — or inspect our sample payment system lesson first.
Key Takeaway: Keep chat gateways ultra-lean by limiting them to WebSocket framing and 1-hop Redis session routing, while offloading offline queues to Mnesia, group fan-out to Kafka + Group Handlers, and binary media to an Asset Service + Blob Store + CDN.
Section 1 + Checkpoint Quiz #1 are unlocked free outside the paywall. Unlock all architecture slides, QPS & sharding trade-off tables, and all 80 narrated HD video lessons with Full Access — or inspect our sample payment system lesson first.
Key Takeaway: Full-duplex WebSockets eliminate idle polling overhead, hop-by-hop acknowledgements with sequence numbers drive deterministic 1/2/blue receipt ticks, content-hashed CDN blobs isolate media load, and Kafka partitions serialize group fan-out without breaking E2EE.
Section 1 + Checkpoint Quiz #1 are unlocked free outside the paywall. Unlock all architecture slides, QPS & sharding trade-off tables, and all 80 narrated HD video lessons with Full Access — or inspect our sample payment system lesson first.
Key Takeaway: Choosing consistency over availability guarantees in-order, loss-free conversations even during gateway crashes, provided clients mitigate multi-million-socket reconnect storms with randomized exponential backoff.
Section 1 + Checkpoint Quiz #1 are unlocked free outside the paywall. Unlock all architecture slides, QPS & sharding trade-off tables, and all 80 narrated HD video lessons with Full Access — or inspect our sample payment system lesson first.
In "System Design: WhatsApp" (Transient Delivery Relay vs. Permanent Cloud Archive), how does a production-grade design handle "Server storage lifecycle" (WhatsApp Core Principle)?