Replication & consistency tradeoffs

Leader/follower lag, quorums, consensus (Raft) at a working level, split brain. Enough to reason about what a partition does to your data layer.

About 26 min read3-question knowledge check

The mental model

Three friends keep a shared shopping list. If they're all in the same room, one person writes "milk" and everyone sees it instantly — one copy, no confusion. Now put them in three different cities, texting updates. The moment they're apart, hard questions appear that didn't exist before: if two people add different items at the same second, whose write wins? If one friend's phone loses signal, do the other two wait for them (so the list stays perfectly in sync but nobody can add anything until the phone comes back) or keep going without them (so the list stays usable but the offline friend now has a stale, divergent copy)?

That is the entire subject of replication and consistency, and it's the same tradeoff every time: the instant you have more than one copy of data, you're choosing between keeping the copies identical and keeping the system available. You cannot have both when the network splits, and networks always eventually split. This is CAP: under a network Partition, you must choose Consistency (refuse writes that can't be safely replicated) or Availability (accept writes and reconcile later). There is no third option during a partition.

The reason an SRE has to understand this — not at PhD depth, but at working depth — is that when a data layer misbehaves at 3am, the failure mode is almost always a consistency decision surfacing: a read that returned stale data because it hit a lagging follower, a write that was lost when a leader failed over, two nodes that both think they're the leader and are corrupting each other. If you don't have the model, these look like random gremlins. With the model, they're predictable consequences of a design choice someone made — and often a choice you can tune.

The vocabulary you need to reason fluently:

  • Leader/follower (primary/replica) — one node takes writes, copies them to followers. Followers lag.
  • Replication lag — how far behind the followers are; the window in which a read can be stale.
  • Quorum — require a majority of nodes to agree before a write counts, so no single failure loses data.
  • Consensus (Raft/Paxos) — the protocol that safely elects a leader and agrees on an ordered log, even through failures.
  • Split brain — two nodes both believe they're the leader; the nightmare, because both accept conflicting writes.
The full lesson continues with 15 more sections
  • Deep dive
  • Internal architecture
  • Real-world use cases
  • Best practices
  • Common mistakes
  • Performance
  • Security
  • Production troubleshooting
  • Advantages & disadvantages
  • Alternatives
  • Interview expectations
  • Interview questions
  • Facts to remember
  • Cheat sheet
  • Quick revision