</> MAANG.io

Expert

Design landmark systems in depth, from Dynamo, GFS, Bigtable and Kafka to payments and ads pipelines.

0 of 232 solved 0%

Section 7: The Machine Assembled - High-Level Architecture & Request Path

Executive Summary: Sections 5 and 6 built the two load-bearing ideas — the ring that locates data and the quorums that define "written." This section bolts them into a running machine: a ring-aware client SDK, any node as per-request coordinator, gossip-based membership, a storage engine per node, and the background repair services. Just as important are the boxes that aren't on the whiteboard — no cache tier, no queue, no central metadata service — each absence defended with a number. Then we walk one read and one write hop by hop against the latency budget and find where the p99 actually hides: not in the diagram, but in a garbage-collection pause on one straggler replica — which makes Section 6's quorum, quietly, your tail-latency defense too.

The interviewer gestures at the whiteboard: "You've given me a ring and a quorum. Draw me the system — and then take one request all the way through it." This is the assembly moment, and it's where the two failure archetypes diverge visibly. The Paper Reciter draws eight boxes — cache, queue, ZooKeeper — because the reference diagrams do. The Single-Node Thinker draws one beautiful storage engine and a cloud labeled "replication." You're going to draw five boxes, defend three absences, and then account for every millisecond of a 10ms read budget.

The Five Boxes — and the Boxes That Aren't There

  • Client SDK (ring-aware): Tenants like Mira's checkout team link a library, not just an HTTP endpoint. The SDK holds a cached copy of the ring — all 16,384 tokens across 64 nodes — refreshed via gossip-fed updates, so it hashes cart:8842 and sends the request directly to a replica that owns it. Routing costs zero network hops. It also owns timeouts and the idempotent retry discipline from Section 4.
  • Coordinator — any node, per request: Whichever node receives the request coordinates it: fans out to the preference list, counts quorum acks, assembles the response. There is no coordinator tier — every node carries the role, so there's nothing special to fail over.
  • Gossip membership: Every node, once per second, exchanges its view — who's alive, who holds which tokens, who's suspected — with one random peer. No master, no election, no external dependency.
  • Per-node storage engine: The WAL, memtable, and SSTables of Section 8. The ring doesn't care what's inside the box — which is exactly why Section 8 can swap it.
  • Background repair services: Hinted handoff delivery, read repair, and Merkle anti-entropy (Section 9) — the three healing layers from Section 6's story of n17 dying mid-write, running as low-priority residents on every node.

Architecture flowchart: Client SDK reaches the coordinator role directly with zero routing hops; the coordinator fans out to the n09, n17 and n23 storage engines (WAL + memtable + SSTables); gossip membership feeds ring and health state to SDK and coordinator; background repair heals replicas

Now the absences — because at 401, what you leave out is scored as hard as what you draw (this is the same discipline the Like Counter module applies to its own missing cache):

Absent box Why it's tempting Why it's absent Flip trigger
Cache tier (Redis in front) "Reads should be fast" Reads hit p50 ~1ms — the store is the latency tier. A cache adds invalidation and breaks read-your-writes for everyone to serve the 0.001% of hot keys A tenant whose entire workload is hot-read — they get a purpose-built read tier, not the platform
Queue in front of writes "Absorb bursts, guarantee durability" Durability is the WAL's job — 2 of 3 fsyncs before ack. A broker adds a hop to the 20ms p99 budget and weakens "written" to "enqueued" Change streams in Section 12 — where a log finally earns a seat, behind the store
Central metadata service (ZooKeeper/etcd) "Someone must own the ring" Gossip converges 64 nodes in ~6s with zero ops-critical dependencies; a consensus service is a scaling ceiling and a new 2 a.m. pager for Mira (HBase chose it legitimately; our availability story leans decentralized) Range partitioning's control plane in Section 12 — strongly consistent metadata earns its seat there

Key Insight: Every box you draw is a thing that can fail, a thing Mira gets paged for, and a hop inside your latency budget. At 401, "I considered a cache tier and here is the number that says no" scores higher than any box you could add.

Quick check before moving on:

Sign in to continue reading

The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.

Sign in to read the full lesson

Sign in to MAANG.io

Use your Google or Microsoft account — no password to remember.

Continue with Google Continue with Microsoft

Please accept the terms above to continue.