Database.Advanced.What is eventual consistency ?

Eventual consistency is a consistency model used in distributed systems to ensure that, given enough time and no new updates, all replicas of a piece of data will converge to the same value.

✅ In Simple Terms:

  • When you update data, that change might not appear instantly on all servers or nodes.
  • But if you wait long enough, and no more updates are made, all nodes will eventually show the same result.

📦 Example:

Imagine a system with 3 database replicas across the world (New York, London, Tokyo):

  1. You update your profile name from “Stan” to “Stanley” via the New York server.
  2. London and Tokyo may still show “Stan” for a few seconds.
  3. After replication catches up, all three servers show “Stanley”.

🧠 Why Use Eventual Consistency?

Because it enables:

  • High availability: systems don’t block waiting for global agreement.
  • Partition tolerance: systems can still work even if some nodes are unreachable.
  • Performance: faster writes due to asynchronous replication.

💡 Real-World Examples:

SystemBehavior
Amazon DynamoDBUpdates are propagated eventually across regions.
CassandraUses tunable consistency — you can opt for eventual.
S3 / Cloud StorageWrites may not be instantly visible in other regions.
Social Media FeedsA like might not appear to all users immediately.

⚠️ Trade-offs:

ProsCons
Fast writes, high availabilityYou may see stale data temporarily
Works well at large scaleConflict resolution can be tricky

🔁 Comparison:

ModelGuarantees
Strong ConsistencyAll users see the same data at the same time.
Eventual ConsistencyAll users will eventually see the same data.
Causal ConsistencyOrder of related operations is preserved.
This entry was posted in Без рубрики. Bookmark the permalink.