CRDTs for engineers

  • 133 views
Uploaded on

 

More in: Technology , Design
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
133
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. CRDTsfor engineers1Thursday, June 27, 13
  • 2. CRDT• Conflict-Free (amongst others)• Replicated• Data• Type2Thursday, June 27, 13
  • 3. CRDT• Conflict-Free (amongst others)• Replicated• Data - obvious• Type - obvious3Thursday, June 27, 13
  • 4. Replicated• Build to be used in distributed systems• multiple replicas can be changedconcurrently• do not require locking4Thursday, June 27, 13
  • 5. Conflict-Free• the big one!• replica merges with predictable behavior!• predictable =:= desired?5Thursday, June 27, 13
  • 6. big words• Associative• Commutative• Idempotent6Thursday, June 27, 13
  • 7. Associative• operations can be applied in any order• x ∧ (y ∧ z) = (x ∧ y) ∧ z7Thursday, June 27, 13
  • 8. Commutative• The values of operations can be swapped.• x ∧ y = y ∧ x• together• we don’t need to care about order8Thursday, June 27, 13
  • 9. Idempotent• not impotent!• applying twice does not change a thing.• f(f(x)) = f(x)9Thursday, June 27, 13
  • 10. Types• CmRDT message based• CvRDT state based (v for vector)• can be emulated10Thursday, June 27, 13
  • 11. CmRDT• based on messages• requires messages to be delivered• needs controls of messages (complex)11Thursday, June 27, 13
  • 12. CvRDT• Based on the objects state• independent from underlaying structure• that’s good!12Thursday, June 27, 13
  • 13. LWW registerVaTa VbTbVbTbTa =< Tb13Thursday, June 27, 13
  • 14. G SetM1 Merge M214Thursday, June 27, 13
  • 15. G SetAM1 Merge M2AA15Thursday, June 27, 13
  • 16. G SetAM1 Merge M2AA16Thursday, June 27, 13
  • 17. G SetAM1 Merge M2AAB B17Thursday, June 27, 13
  • 18. G SetAM1 Merge M2AAB B18Thursday, June 27, 13
  • 19. G SetAM1 Merge M2AAB B CC19Thursday, June 27, 13
  • 20. G SetAM1 Merge M2AAB B CC20Thursday, June 27, 13
  • 21. G SetAM1 Merge M2AAB B CCD DDUnion21Thursday, June 27, 13
  • 22. G CounterMaster 1Master 2Master 30 0 00 0 00 0 0M1 M2 Merge000M30 0 0 0= Max= Max= MaxSumSumSumSum22Thursday, June 27, 13
  • 23. G CounterMaster 1Master 2Master 31 1 10 0 00 0 0M1 M2 Merge100M31 1 1 1= Max= Max= MaxSumSumSumSum23Thursday, June 27, 13
  • 24. G CounterMaster 1Master 2Master 31 1 14 4 40 0 0M1 M2 Merge140M35 5 5 5= Max= Max= MaxSumSumSumSum24Thursday, June 27, 13
  • 25. G CounterMaster 1Master 2Master 31 1 14 4 40 0 0M1 M2 Merge140M35 5 5 5= Max= Max= MaxSumSumSumSum25Thursday, June 27, 13
  • 26. G CounterMaster 1Master 2Master 31 1 14 4 45 0 5M1 M2 Merge145M310 5 10 10= Max= Max= MaxSumSumSumSum26Thursday, June 27, 13
  • 27. G CounterMaster 1Master 2Master 31 1 14 4 45 0 5M1 M2 Merge145M310 5 10 10= Max= Max= MaxSumSumSumSum27Thursday, June 27, 13
  • 28. G CounterMaster 1Master 2Master 31 1 14 4 45 0 5M1 M2 Merge145M310 5 10 10= Max= Max= MaxSumSumSumSum28Thursday, June 27, 13
  • 29. G CounterMaster 1Master 2Master 31 1 14 4 45 7 7M1 M2 Merge147M310 12 12 12= Max= Max= MaxSumSumSumSum29Thursday, June 27, 13
  • 30. G CounterMaster 1Master 2Master 31 1 14 4 45 7 7M1 M2 Merge147M310 12 12 12= Max= Max= MaxSumSumSumSum30Thursday, June 27, 13
  • 31. now it’s like lego31Thursday, June 27, 13
  • 32. PN CounterIncrements DecrementsG Counter G Counter32Thursday, June 27, 13
  • 33. 2P SetAdditions DeletionsG Set G Set33Thursday, June 27, 13
  • 34. 2P Set• Can only be added once• Deleted for good34Thursday, June 27, 13
  • 35. 35Thursday, June 27, 13
  • 36. PN Set7 A0 B3 C-2 DPN CounterAC36Thursday, June 27, 13
  • 37. PN Set• Partial merges can lead to negative values• Adds might (temporarily) have no effect37Thursday, June 27, 13
  • 38. OR SetM1,1 AM1,1 AM2,1 AM1,2 BM1,3 AAB2P Set38Thursday, June 27, 13
  • 39. OR Set39Thursday, June 27, 13
  • 40. OR SetM1,1 A M1,1 A A40Thursday, June 27, 13
  • 41. OR SetM1,1 A M1,1 A AM1,2 B B41Thursday, June 27, 13
  • 42. OR SetM1,1 A M1,1 A AM1,2 B BM2,1 B42Thursday, June 27, 13
  • 43. OR SetM1,1 A M1,1 A AM1,2 B BM2,1 BM1,2 B43Thursday, June 27, 13
  • 44. OR SetM1,1 A M1,1 A AM1,2 B BM2,1 BM1,2 BM1,3 B44Thursday, June 27, 13
  • 45. OR SetM1,1 A M1,1 A AM1,2 B M2,1 BM1,2 BM1,3 BM2,1 BM1,3 BM2,1 BM1,3 B45Thursday, June 27, 13
  • 46. OR Set• Elements have a unique ID• delete• Elements might ‘reappear’ after a merge• lots of trash46Thursday, June 27, 13
  • 47. Questions?• Code?• C-x C-+• https://github.com/Licenser/ecrdt• more links there!47Thursday, June 27, 13