Understand replication and consistency
See how replicas improve availability while creating coordination choices.
- Compare synchronous and asynchronous replication and explain eventual consistency.
Replication keeps copies of data on multiple nodes. Synchronous replication waits for acknowledgements before confirming a write, which can improve durability or read-after-write behavior at the cost of latency and availability during failures. Asynchronous replication responds sooner, but replicas can lag. Eventual consistency means replicas converge if updates stop and communication resumes; it does not promise when a particular read will see an update.
A product can reduce confusion with read-your-writes routing, version indicators, or by waiting for a chosen replication acknowledgement before reporting success.
Practice: break replication
Try it
Up to 15 XPWrite, read and crash
Start with asynchronous replication:
- Write twice, then read from a replica. What does a user see?
- Crash the primary before replicating. What happened to the writes the client was told succeeded?
Now turn on synchronous replication:
- Write again, and compare the time it takes.
- Take a replica offline and write. What’s the new problem?
- Primaryv1
- Replica 1v1
- Replica 2v1
The primary and both replicas are at v1.
Try it
Up to 15 XPWhat does this feature need?
Stale data is fine for some reads and a real bug for others. Decide what each one needs.
“Showing the like count on a post.”
“A user reloading the profile they just edited.”
“Checking the balance before a withdrawal.”
“A dashboard of yesterday’s sales.”
“Checking if a username is taken while signing up.”
Key takeaways
Replication improves resilience but copies can disagree temporarily.
Synchronous acknowledgement trades latency and availability for stronger write guarantees.
Eventual convergence does not imply a freshness deadline.
Lesson quiz
5 questions · pass with 4 correct · up to 50 XP
Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.
Questions about this lesson
Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.
Loading posts…