</> MAANG.io
system design · 301

Advanced

Master system design interviews with scalable architecture patterns, distributed systems, and real-world design challenges.

0/480 solved 0% complete

Section 6: Five Boxes and a Confession - High-Level Architecture

Executive Summary: This section assembles the baseline architecture: five components, one transaction, no queue, no stream, no second region. We defend every absence with a number from the workload analysis, walk the write and read paths end to end, and — the Staff move — name the precise threshold at which this honest, boring design stops being correct. The architecture here is restraint made visible: a design sized for the median post that admits, in a single sentence, exactly where the celebrity post will break it.

The interviewer hands you the marker: "Okay — draw it." This is the moment the two failure archetypes diverge for good. The Dismissal draws two boxes and an UPDATE statement and considers the matter closed. The Citadel draws eleven boxes, three of which say "Kafka," for a feature whose median post will collect perhaps a dozen likes in its lifetime. You are going to draw five boxes, defend why there isn't a sixth, and then do the thing neither archetype can: write down the number at which your own drawing becomes wrong.

Key Insight: At Staff level, the architecture diagram is scored twice — once for what's on it, and once for what isn't. Every absent component you can defend with a measured number is worth more than a present component you can't. Restraint is the architecture.

The Five Boxes

Each box earns its place by doing a job the requirements demand, and nothing more:

Component Job The number that sizes it
Client Optimistic UI: fill the heart instantly, reconcile later Perceived like-latency ~0 regardless of the p99 ≤ 150ms ack budget
API gateway Verify the received identity, validate the request, route Sits on every one of ~350K reads/s and ~35K writes/s at peak
Like service Owns the semantics: the state-setting PUT/DELETE from Section 4, the atomic conditional write below Stateless; scales horizontally with the ~11.6K writes/s average
KV store The likes ledger (post_id, user_id) plus the co-located counter row — Section 5's model, verbatim 1B write actions/day; partitioned so no node sees more than its share
Redis count cache post_id → count, serving the render hot path ~25GB holds every count that will be read today — one modest cluster absorbing ~350K reads/s peak

Architecture flowchart of the five boxes: the client sends PUT/DELETE writes and batched count reads to the API gateway; the like service makes one atomic conditional write to the KV store and updates the Redis count cache, which the gateway queries with pipelined lookups and which reads the counter row on a miss

That's the whole system. Now defend the empty space around it.

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.