Knowledge Guide
HomeSystem DesignReplication

Replication Lag & Failover — Read-Your-Writes, Split-Brain & Fencing

Replicas make reads fast — and consistency hard

You add read replicas to scale reads and survive a node loss. The catch: replication is usually asynchronous, so a follower is always slightly behind the leader. That replication lag (tens to hundreds of ms, or seconds under load) produces real, user-visible bugs.

A client writes to the leader, then reads from an async follower that has not yet received the update, getting stale data; the fix is to route that user reads to the leader
A client writes to the leader, then reads from an async follower that has not yet received the update, getting stale data; the fix is to route that user reads to the leader

The three anomalies lag causes

Sync vs async: synchronous replication (wait for a replica to ack) removes lag but adds write latency and stalls if the replica is down. Most systems use semi-sync — one synchronous replica for durability, the rest async.

Failover: when the leader dies

A follower is promoted to leader. The dangers:

Takeaways


Re-authored for this guide; replication-lag timeline hand-authored as SVG. Follows DDIA ch. 5. See also: Quorum, Leader and Follower, CAP Theorem, and (Concurrency) the same race/visibility intuition.

🤖 Don't fully get this? Learn it with Claude

Stuck on Replication Lag & Failover — Read-Your-Writes, Split-Brain & Fencing? Open Claude, copy a block below, and it'll teach you this exact concept — visually and interactively.

🎨 Explain it visually

Build the mental picture, not memorization.

I just read a lesson on **Replication Lag & Failover — Read-Your-Writes, Split-Brain & Fencing** (System Design) and want to truly understand it. Explain Replication Lag & Failover — Read-Your-Writes, Split-Brain & Fencing from first principles using ONE vivid real-world analogy and a visual mental model — draw it as ASCII art or a clear step-by-step diagram — with a concrete example using real numbers. Then ask me one question to check I got the mental picture, and wait for my reply. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🤔 Walk me through it (interactive)

Socratic — adapts to where you're stuck.

Teach me **Replication Lag & Failover — Read-Your-Writes, Split-Brain & Fencing** interactively. Ask me ONE guiding question at a time, wait for my answer, and adapt to my confusion — build the idea with me step by step instead of explaining it all at once. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧪 Quiz me & fix my gaps

Active recall exposes what you missed.

Quiz me on **Replication Lag & Failover — Read-Your-Writes, Split-Brain & Fencing** with 5 questions, easy to tricky, ONE at a time. Tell me if each answer is right; at the end, explain clearly what I got wrong and why. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧠 Make it stick

Intuition + hook + flashcards for long-term memory.

Help me remember **Replication Lag & Failover — Read-Your-Writes, Split-Brain & Fencing** for the long term: give the one-sentence intuition, a memorable hook/mnemonic, a tiny worked example, and 3 active-recall flashcards (Q -> A). If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.

📝 My notes