</> MAANG.io
system design · 201

Intermediate

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

0/124 solved 0% complete

Replication

maang.io System Design Series


Replication keeps copies of your data on multiple machines so the system survives failures and serves reads at scale. The whole subject is choosing who can accept a write and how fast copies converge — single-leader (simple, one writer), multi-leader (write anywhere, resolve conflicts), or leaderless quorums (Dynamo-style). Every choice trades consistency against availability, the CAP tension made concrete.

This deep dive comes in three parts:

  • Foundations & Core Concepts — the three replication models and synchronous vs asynchronous.
  • Internals — replication logs, lag, read-after-write guarantees, and failover/split-brain, with worked numbers.
  • Interview — Staff/Principal Q&A: consistency guarantees, failover reasoning, and model selection.

Replication — Part 2: Internals & Implementation

maang.io System Design Series


What is this?

Back to the bank. In Part 1 we said the leader "streams its changes down to the followers." That sentence hides three deep questions a Staff engineer has to answer precisely:

  1. What exactly gets shipped? Do you send "post a $50 deposit to account 42" (an instruction to re-run), or the literal changed bytes of the ledger page? This is the replication log format — and getting it wrong silently corrupts your copies.
  2. What can a reader observe while a follower is behind? Replication lag isn't just "slow" — it lets clients see impossible things (their own deposit vanishing) unless you pick the right consistency guarantee.
  3. What happens the instant head office burns down? Promoting a branch — failover — is the most dangerous ten seconds in the life of a database, and if you botch it, two branches both start posting entries and your ledgers diverge forever (split-brain).

Let's take them in order, then do a worked quorum example with real numbers, then name the failure modes that get real teams paged.


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.