Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Like this presentation? Why not share!

10,933 views

Published on

That is, until the advent of Conflict-Free Replicated Data Types (CRDTs). CRDTs are data-structures that tolerate eventual consistency. They replace traditional data-structure implementations and all have the property that, given any number of conflicting versions of the same datum, there is a single state on which they converge (monotonicity). This talk will discuss some of the most useful CRDTs and how to apply them to solve real-world data problems.

No Downloads

Total views

10,933

On SlideShare

0

From Embeds

0

Number of Embeds

91

Shares

0

Downloads

84

Comments

0

Likes

18

No embeds

No notes for slide

- 1. Eventually-Consistent Data Structures Sean Cribbs @seancribbs #CRDT Berlin Buzzwords 2012
- 2. I work for Basho We make
- 3. Riak is Eventually ConsistentSo are Voldemort and Cassandra
- 4. EventualConsistency Replicated Loose coordination 3 Forward progression
- 5. Eventual is Good ✔ Fault-tolerant ✔ Highly available ✔ Low-latency
- 6. Consistency? No clear winner! Throw one out? 3 Keep both?B
- 7. Consistency? No clear winner! Throw one out? 3 Keep both?B Cassandra
- 8. Consistency? No clear winner! Throw one out? 3 Keep both?B Cassandra Riak & Voldemort
- 9. Conﬂicts! A! B! Now what?
- 10. Semantic Resolution• Your app knows the domain - use business rules to resolve• Amazon Dynamo’s shopping cart
- 11. Semantic Resolution • Your app knows the domain - use business rules to resolve • Amazon Dynamo’s shopping cart“Ad hoc approaches have proven brittle and error-prone”
- 12. Conﬂict-Free Replicated Data Types
- 13. Conﬂict-Free Replicated Data Types useful abstractions
- 14. Conﬂict-Free Replicated Data Types multipleindependent copies useful abstractions
- 15. resolves automatically toward a single value Conﬂict-Free Replicated Data Types multipleindependent copies useful abstractions
- 16. CRDT Flavors• Convergent: State • Weak messaging requirements•Commutative: Operations •Reliable broadcast required •Causal ordering sufficient
- 17. Convergent CRDTs
- 18. Commutative CRDTs
- 19. RegistersA place to put your stuff
- 20. Registers• Last-Write Wins (LWW-Register) • e.g. Columns in Cassandra• Multi-Valued (MV-Register) • e.g. Objects (values) in Riak
- 21. Counters Keeping tabs
- 22. G-Counter
- 23. G-Counter// Starts empty[]
- 24. G-Counter// Starts empty[]// A increments twice, forwarding state[{a,1}] // == 1[{a,2}] // == 2
- 25. G-Counter// Starts empty[]// A increments twice, forwarding state[{a,1}] // == 1[{a,2}] // == 2 // B increments [{b,1}] // == 1
- 26. G-Counter// Starts empty[]// A increments twice, forwarding state[{a,1}] // == 1[{a,2}] // == 2 // B increments [{b,1}] // == 1// Merging[{a,2}, {b,1}] [{a,1}, {b,1}]
- 27. PN-Counter// A PN-Counter{ P = [{a,10},{b,2}], N = [{a,1},{c,5}]}// == (10+2)-(1+5) == 12-6 == 6
- 28. SetsMembers Only
- 29. G-Set
- 30. G-Set// Starts empty{}
- 31. G-Set// Starts empty{}// A adds a and b, forwarding state{a}{a,b}
- 32. G-Set// Starts empty{}// A adds a and b, forwarding state{a}{a,b} // B adds c {c}
- 33. G-Set// Starts empty{}// A adds a and b, forwarding state{a}{a,b} // B adds c {c}// Merging{a,b,c} {a,c}
- 34. 2P-Set
- 35. 2P-Set// Starts empty{A={},R={}}
- 36. 2P-Set// Starts empty{A={},R={}}// A adds a and b, forwarding state,// removes a{A={a}, R={}} // == {a}{A={a,b},R={}} // == {a,b}
- 37. 2P-Set// Starts empty{A={},R={}}// A adds a and b, forwarding state,// removes a{A={a}, R={}} // == {a}{A={a,b},R={}} // == {a,b}{A={a,b},R={a}} // == {b}
- 38. 2P-Set// Starts empty{A={},R={}}// A adds a and b, forwarding state,// removes a{A={a}, R={}} // == {a}{A={a,b},R={}} // == {a,b}{A={a,b},R={a}} // == {b} // B adds c
- 39. 2P-Set// Starts empty{A={},R={}}// A adds a and b, forwarding state,// removes a{A={a}, R={}} // == {a}{A={a,b},R={}} // == {a,b}{A={a,b},R={a}} // == {b} // B adds c {A={c},R={}} // == {c}
- 40. 2P-Set// Starts empty{A={},R={}}// A adds a and b, forwarding state,// removes a{A={a}, R={}} // == {a}{A={a,b},R={}} // == {a,b}{A={a,b},R={a}} // == {b} // B adds c {A={c},R={}} // == {c}// Merging
- 41. 2P-Set// Starts empty{A={},R={}}// A adds a and b, forwarding state,// removes a{A={a}, R={}} // == {a}{A={a,b},R={}} // == {a,b}{A={a,b},R={a}} // == {b} // B adds c {A={c},R={}} // == {c}// Merging{A={a,b,c},R={a}} {A={a,c}, R={}}
- 42. LWW-Element-Set
- 43. OR-Set
- 44. G = (V,E)Graphs E⊆V×V
- 45. G = (V,E)Graphs E⊆V×V
- 46. G = (V,E)Graphs E⊆V×V
- 47. Use-Cases• Social graph (OR-Set or a Graph)• Web page visits (G-Counter)• Shopping Cart (Modiﬁed OR-Set)• “Like” button (U-Set)
- 48. Challenges: GC• CRDTs are inefficient• Synchronization may be required
- 49. Challenges: Responsibility• Client • Erlang: mochi/statebox • Clojure: reiddraper/knockbox • Ruby: aphyr/meangirls• Server • Very few options
- 50. Thanks

No public clipboards found for this slide

×
### Save the most important slides with Clipping

Clipping is a handy way to collect and organize the most important slides from a presentation. You can keep your great finds in clipboards organized around topics.

Be the first to comment