Eventual consistency explained

Eventual consistency is a consistency model used in distributed computing to achieve high availability that informally guarantees that, if no new updates are made to a given data item, eventually all accesses to that item will return the last updated value.[1] Eventual consistency, also called optimistic replication,[2] is widely deployed in distributed systems and has origins in early mobile computing projects.[3] A system that has achieved eventual consistency is often said to have converged, or achieved replica convergence.[4] Eventual consistency is a weak guarantee – most stronger models, like linearizability, are trivially eventually consistent.

Eventually-consistent services are often classified as providing BASE semantics (basically-available, soft-state, eventual consistency), in contrast to traditional ACID (atomicity, consistency, isolation, durability).[5] [6] In chemistry, a base is the opposite of an acid, which helps in remembering the acronym.[7] According to the same resource, these are the rough definitions of each term in BASE:

Eventual consistency is sometimes criticized[8] as increasing the complexity of distributed software applications. This is partly because eventual consistency is purely a liveness guarantee (reads eventually return the same value) and does not guarantee safety: an eventually consistent system can return any value before it converges.

Conflict resolution

In order to ensure replica convergence, a system must reconcile differences between multiple copies of distributed data. This consists of two parts:

The most appropriate approach to reconciliation depends on the application. A widespread approach is "last writer wins". Another is to invoke a user-specified conflict handler. Timestamps and vector clocks are often used to detect concurrency between updates. Some people use "first writer wins" in situations where "last writer wins" is unacceptable.[10]

Reconciliation of concurrent writes must occur sometime before the next read, and can be scheduled at different instants:[11]

Strong eventual consistency

Whereas eventual consistency is only a liveness guarantee (updates will be observed eventually), strong eventual consistency (SEC) adds the safety guarantee that any two nodes that have received the same (unordered) set of updates will be in the same state. If, furthermore, the system is monotonic, the application will never suffer rollbacks. A common approach to ensure SEC is conflict-free replicated data types.[12]

See also

Further reading

Notes and References

  1. Vogels . W. . Werner Vogels. 10.1145/1435417.1435432 . Eventually consistent . Communications of the ACM . 52 . 40–44 . 2009 . free .
  2. Vogels . W. . Werner Vogels. Eventually Consistent . 10.1145/1466443.1466448 . Queue . 6 . 6 . 14–19 . 2008 . free .
  3. Book: Terry . D. B. . Theimer . M. M. . Petersen . K. . Demers . A. J. . Spreitzer . M. J. . Hauser . C. H. . Managing update conflicts in Bayou, a weakly connected replicated storage system . 10.1145/224056.224070 . Proceedings of the fifteenth ACM symposium on Operating systems principles - SOSP '95 . 172 . 1995 . 978-0897917155 . 10.1.1.12.7323 . 7834967 .
  4. Petersen . K. . Spreitzer . M. J. . Terry . D. B. . Theimer . M. M. . Demers . A. J. . Flexible update propagation for weakly consistent replication . 10.1145/269005.266711 . ACM SIGOPS Operating Systems Review . 31 . 5 . 288 . 1997 . 10.1.1.17.555 .
  5. Pritchett . D. . Base: An Acid Alternative . 10.1145/1394127.1394128 . Queue . 6 . 3 . 48–55 . 2008 . free .
  6. Bailis . P. . Ghodsi . A. . 10.1145/2460276.2462076 . Eventual Consistency Today: Limitations, Extensions, and Beyond . Queue . 11 . 3 . 20 . 2013 . free .
  7. Web site: Roe . Charles . ACID vs. BASE: The Shifting pH of Database Transaction Processing . DATAVERSITY . March 2012 . DATAVERSITY Education, LLC . 29 August 2019.
  8. [XSKT Cần Thơ F.C.|H]
  9. Book: Demers . A. . Greene . D. . Hauser . C. . Irish . W. . Larson . J. . 10.1145/41840.41841 . Epidemic algorithms for replicated database maintenance . Proceedings of the sixth annual ACM Symposium on Principles of distributed computing - PODC '87 . 1 . 1987 . 978-0-89791-239-6. 1889203 .
  10. Rockford Lhotka."Concurrency techniques" .2003.
  11. Web site: 2011-03-23. Olivier Mallassi. 2010-06-09. OCTO Talks!. Let's play with Cassandra… (Part 1/3). Of course, at a given time, chances are high that each node has its own version of the data. Conflict resolution is made during the read requests (called read-repair) and the current version of Cassandra does not provide a Vector Clock conflict resolution mechanisms [sic] (should be available in the version 0.7). Conflict resolution is so based on timestamp (the one set when you insert the row or the column): the higher timestamp win[s] and the node you are reading the data [from] is responsible for that. This is an important point because the timestamp is specified by the client, at the moment the column is inserted. Thus, all Cassandra clients’ [sic] need to be synchronized....
  12. Shapiro. Marc. Preguiça. Nuno. Carlos. Baquero. Marek. Zawirski. 2011-10-10. Conflict-free replicated data types. SSS'11 Proceedings of the 13th International Conference on Stabilization, Safety, and the Security of Distributed Systems. Springer-Verlag Berlin, Heidelberg. 386–400.