We Hear You Like Papers: Eventual Consistency

We Hear You Like Papers: Eventual Consistency

Given at Women Who Code Sydney IT meetup

Resources: https://github.com/CaitieM20/Talks/tree/master/SoWeHearYouLikePapers

9128d500301ae51524e887bb680f471d?s=128

Caitie McCaffrey

December 07, 2016
Tweet

Transcript

  1. 6.
  2. 9.

    1983 1995 Thinking Consistency Detection of Mutual Inconsistency in Distributed

    Systems Managing Update Conflicts in Bayou, a Weakly Connected Replicated Storage System Brewer's conjecture & the feasibility of consistent, available, partition-tolerant web services 2002
  3. 10.

    2015 2011 Conflict-free replicated Data Types Feral Concurrency Control: An

    Empirical Investigation of Modern Application Integrity Thinking Consistency
  4. 14.
  5. 16.

    High availability “In some environments it is desirable or necessary

    to permit users to continue modifying resources such as files when the network is partitioned”
  6. 18.

    Version Vectors “A Version Vector for a file f is

    a sequence of n pairs, where n is the number of sites at which f is stored … the ith vector entry counts the number Vi of updates to f made at site Si” <A:9, B:7, C:22, D:3>
  7. 22.

    ABCD AB CD Partition Graph <A:0, B:0, C:0, D:0> <A:0,

    B:0, C:0, D:0> <A:0, B:0, C:0, D:0>
  8. 23.

    ABCD AB CD Partition Graph <A:0, B:0, C:0, D:0> <A:0,

    B:0, C:0, D:0> <A:1, B:0, C:0, D:0>
  9. 24.

    ABCD AB CD D BC A Partition Graph T2 <A:0,

    B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:1, B:0, C:0, D:0> <A:1, B:0, C:0, D:0>
  10. 25.

    ABCD AB CD D BC A Partition Graph T2 <A:0,

    B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:1, B:0, C:0, D:0> <A:1, B:0, C:0, D:0> No Conflict!
  11. 26.

    ABCD AB CD D BC A Partition Graph T2 <A:0,

    B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:1, B:0, C:0, D:0> <A:1, B:0, C:0, D:0> <A:1, B:0, C:0, D:0>
  12. 27.

    ABCD AB CD D BC A Partition Graph T2 <A:0,

    B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:1, B:0, C:0, D:0> <A:2, B:0, C:0, D:0> <A:1, B:0, C:1, D:0>
  13. 28.

    ABCD AB CD D BC A BCD Partition Graph T2

    <A:0, B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:1, B:0, C:0, D:0> <A:2, B:0, C:0, D:0> <A:1, B:0, C:1, D:0>
  14. 29.

    ABCD AB CD D BC A BCD Partition Graph T2

    <A:0, B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:1, B:0, C:0, D:0> <A:2, B:0, C:0, D:0> <A:1, B:0, C:1, D:0> No Conflict!
  15. 30.

    ABCD AB CD D BC A BCD Partition Graph T2

    <A:0, B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:1, B:0, C:0, D:0> <A:2, B:0, C:0, D:0> <A:1, B:0, C:1, D:0> <A:1, B:0, C:1, D:0>
  16. 31.

    ABCD AB CD D BC A BCD Partition Graph T2

    <A:0, B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:1, B:0, C:0, D:0> <A:2, B:0, C:0, D:0> <A:1, B:0, C:1, D:0> <A:1, B:0, C:1, D:0> ABCD
  17. 32.

    ABCD AB CD D BC A BCD ABCD Partition Graph

    T2 <A:0, B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:0, B:0, C:0, D:0> <A:1, B:0, C:0, D:0> <A:2, B:0, C:0, D:0> <A:1, B:0, C:1, D:0> <A:1, B:0, C:1, D:0> Conflict!
  18. 33.

    Conflict Resolution “A conflict detection mechanism, while valuable, has increased

    effect if there is also a method for reconciling conflicts automatically”
  19. 34.
  20. 35.

    Bayou Summary System designed for weak connectivity Eventual consistency via

    application- defined dependency checks and developer defined merge procedures Epidemic algorithms to replicate state
  21. 36.
  22. 37.

    Bayou Take aways & thoughts “Humans would rather deal with

    the occasional unresolvable conflict than incur the adverse impact on availability”
  23. 38.
  24. 40.

    Consistency Models Linearizable Sequential Causal Pipelined random access memory Read

    your write Monotonic read Monotonic write Write from read CP Consistency AP Consistency
  25. 41.
  26. 42.

    CRDTs Summary Mathematical properties & epidemic algorithms / gossip protocols

    Strong Eventual Consistency - apply updates immediately, no conflicts, or rollbacks via
  27. 44.

    Applying rollbacks is hard Restrict operation space to get provably

    convergent systems Active area of research Resolving Conflicts
  28. 45.

    Applying rollbacks is hard Restrict operation space to get provably

    convergent systems Active area of research Resolving Conflicts
  29. 46.
  30. 47.

    Feral mechanisms for keeping DB integrity Application-level mechanisms Analyzed 67

    open source Ruby on Rails Applications Unsafe > 13% of the time 
 (uniqueness & foreign key constraint violations)
  31. 48.

    Concurrency control is hard! Availability is important to application developers

    Home-rolling your own concurrency control or consensus algorithm is very hard and difficult to get correct!
  32. 49.

    Eventual Consistency We want highly available systems so we must

    use weaker forms of consistency (remember CAP) Application semantics helps us make better tradeoffs Do not recreate the wheel, leverage existing research allows us to not repeat past mistakes Forced into a feral world but this may change soon! Tl;DR