Eventual Consistency: Availability Over Immediacy
Eventual consistency trades immediate correctness for high availability. It's used in distributed systems where being online is critical. The footgun is assuming "eventual" implies a specific timeframe; it only guarantees convergence if updates cease.
WHY IT EXISTS In distributed systems, forcing every server (replica) to agree on data instantly is slow and fragile. If one replica is down or slow to respond, the entire system could halt or degrade. Eventual consistency was created to solve this by prioritizing high availability, allowing the system to remain responsive and online even if replicas are temporarily out of sync.
THE MENTAL MODEL Think of eventual consistency as "optimistic replication." The system optimistically accepts new data on one replica without waiting for all other replicas to confirm it. The core promise is not immediate agreement, but eventual convergence: if updates to a piece of data stop, all replicas will eventually settle on the same, final value.
HOW IT WORKS When a write occurs, it's applied to one or more replicas. For a period of time, different replicas may hold different versions of the data. The system works in the background to propagate the latest update to all other replicas. During this replication window, a read request might return an older value depending on which replica it hits. Once all replicas have received the update, the system is said to have achieved replica convergence for that piece of data.
WHEN TO USE IT Use this model when high availability is more important than immediate, strict consistency. It is widely deployed in large-scale distributed systems where downtime is unacceptable and some data staleness can be tolerated. Its origins in early mobile computing highlight its utility in environments with intermittent connectivity.
WHEN NOT TO USE IT Avoid eventual consistency for use cases requiring strict data integrity, where even temporary inconsistency is unacceptable. Stronger consistency models are necessary for systems like financial ledgers, banking transactions, or real-time inventory management where every read must reflect the absolute latest write.
ONE CANONICAL EXAMPLE A distributed database replicates data across multiple data centers for high availability. When a user updates their profile, the change is written to one replica. The system remains available for reads and writes, and over time, this update is propagated to all other replicas. Eventually, all data centers will have the new profile data, but for a short period, some users might see the old information.
Read the original → en.wikipedia.org
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.