Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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

Caitie McCaffrey

December 07, 2016
Tweet

More Decks by Caitie McCaffrey

Other Decks in Technology

Transcript

  1. 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
  2. 2015 2011 Conflict-free replicated Data Types Feral Concurrency Control: An

    Empirical Investigation of Modern Application Integrity Thinking Consistency
  3. 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”
  4. 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>
  5. 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>
  6. 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>
  7. 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>
  8. 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!
  9. 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>
  10. 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>
  11. 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>
  12. 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!
  13. 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>
  14. 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
  15. 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!
  16. Conflict Resolution “A conflict detection mechanism, while valuable, has increased

    effect if there is also a method for reconciling conflicts automatically”
  17. Bayou Summary System designed for weak connectivity Eventual consistency via

    application- defined dependency checks and developer defined merge procedures Epidemic algorithms to replicate state
  18. Bayou Take aways & thoughts “Humans would rather deal with

    the occasional unresolvable conflict than incur the adverse impact on availability”
  19. Consistency Models Linearizable Sequential Causal Pipelined random access memory Read

    your write Monotonic read Monotonic write Write from read CP Consistency AP Consistency
  20. CRDTs Summary Mathematical properties & epidemic algorithms / gossip protocols

    Strong Eventual Consistency - apply updates immediately, no conflicts, or rollbacks via
  21. Applying rollbacks is hard Restrict operation space to get provably

    convergent systems Active area of research Resolving Conflicts
  22. Applying rollbacks is hard Restrict operation space to get provably

    convergent systems Active area of research Resolving Conflicts
  23. 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)
  24. 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!
  25. 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