Um momento
0x30Lesson 4 of 9

Understand replication and consistency

See how replicas improve availability while creating coordination choices.

14 min 5-question quiz
By the end of this lesson you can
  • 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.

Python simulation · illustrative only
1primary_value = "v2"
2replica_value = "v1"
3print(f"primary={primary_value}, replica={replica_value}")
4replica_value = primary_value
5print(f"after replication: {replica_value}")
Output
primary=v2, replica=v1
after replication: v2

This Python example illustrates replica lag. A product can reduce confusion with read-your-writes routing, version indicators, or by waiting for a chosen replication acknowledgement before reporting success.

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…

Gostou da aula? 😆👍
Apoie nosso trabalho com uma doação: