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

CRDT 101

CRDT 101

Sergey Arkhipov

December 09, 2014
Tweet

More Decks by Sergey Arkhipov

Other Decks in Programming

Transcript

  1. CRDT 101
    Архипов Сергей @9seconds
    10.12.2014

    View full-size slide

  2. Наши проблемы ← CRDT
    ― Network
    ― RAM
    ― Persistent storage
    ― CPU

    View full-size slide

  3. 90е ← CRDT
    Web Server
    Application
    Database

    View full-size slide

  4. 90е ← CRDT
    Web Server
    Application
    Database

    View full-size slide

  5. 2000: Load Balancing ← CRDT

    View full-size slide

  6. 2000: Load Balancing ← CRDT

    View full-size slide

  7. 2002: Replication ← CRDT

    View full-size slide

  8. 2004: Caching ← CRDT

    View full-size slide

  9. 2004: Caching ← CRDT

    View full-size slide

  10. 2006: Web 2.0 + Amazon = Sharding ← CRDT

    View full-size slide

  11. 2008: NoSQL ← CRDT

    View full-size slide

  12. 2010: MapReduce ← CRDT

    View full-size slide

  13. 2000: CAP ← CRDT
    ― Consistency
    ― Availability
    ― Partition Tolerance

    View full-size slide

  14. 2009: CRDT ← CRDT

    View full-size slide

  15. 2009: CRDT ← CRDT

    View full-size slide

  16. 2009: CRDT ← CRDT

    View full-size slide

  17. 2009: CRDT ← CRDT

    View full-size slide

  18. 2009: CRDT ← CRDT

    View full-size slide

  19. 2009: CRDT ← CRDT

    View full-size slide

  20. 2009: CRDT ← CRDT
    CmRDT — Commutative Replicated Data Type
    Assuming causal delivery of updates and
    method termination, any op-based object that
    satisfies the commutativity property for all
    concurrent updates, and whose delivery
    precondition is satisfied by causal delivery, is
    strong eventual consistent.

    View full-size slide

  21. LWW-element-Set ← CRDT

    View full-size slide

  22. LWW-element-Set ← CRDT
    tweet = {
    id: "3b6730f1-50c7-4fad-ac47-ba8c2efadfc1",
    timestamp: 1416757099,
    user: "9seconds"
    message: "Test message"
    }
    def tweet_to_lww(tweet):
    return tweet["timestamp"], tweet

    View full-size slide

  23. LWW-element-Set ← CRDT
    A R A R

    View full-size slide

  24. LWW-element-Set ← CRDT
    A R A R
    (t1, a)

    View full-size slide

  25. LWW-element-Set ← CRDT
    A R A R
    (t1, a) (t1, a)

    View full-size slide

  26. LWW-element-Set ← CRDT
    A R A R
    (t2, b)
    (t1, a) (t1, a)

    View full-size slide

  27. LWW-element-Set ← CRDT
    A R A R
    (t1, a) (t1, a)
    (t2, b)

    View full-size slide

  28. LWW-element-Set ← CRDT
    A R A R
    (t3, c)
    (t1, a) (t1, a)
    (t2, b)

    View full-size slide

  29. LWW-element-Set ← CRDT
    A R A R
    (t1, a) (t1, a)
    (t2, b) (t3, c)
    (t2, b)
    (t2, b)
    (t4, c)

    View full-size slide

  30. LWW-element-Set ← CRDT
    A R A R
    (t1, a) (t1, a)
    (t2, b) (t3, c)
    (t2, b)
    (t2, b)
    (t4, c) (t4, c)

    View full-size slide

  31. LWW-element-Set ← CRDT
    A R A R
    (t1, a) (t1, a)
    (t2, b) (t3, c)
    (t2, b)
    (t2, b)
    (t4, c) (t4, c)
    Synchronizer (SoundCloud Roshi)

    View full-size slide

  32. LWW-element-Set ← CRDT
    A
    R
    (t1, a) (t1, a)
    (t3, c)
    (t2, b) (t2, b)
    (t4, c) (t4, c)

    View full-size slide

  33. LWW-element-Set ← CRDT
    A
    R
    (t1, a) (t3, c)
    (t2, b)
    (t4, c)

    View full-size slide

  34. LWW-element-Set ← CRDT
    (t1, a)
    (t2, b)

    View full-size slide

  35. LWW-element-Set ← CRDT
    A R A R
    (t1, a) (t1, a)
    (t2, b) (t3, c)
    (t2, b)
    (t4, c) (t4, c)
    Synchronizer (SoundCloud Roshi)
    (t3, c)

    View full-size slide

  36. Many CRDTs! ← CRDT
    ― Op-based Counter
    ― G-Counter
    ― State-based PN Counter
    ― LWW-Register
    ― MV-Register
    ― G-Set
    ― 2P-Set
    ― LWW-element-Set
    ― PN-Set
    ― OR Set
    ― Add-only monotonic DAG
    ― Add-Remove Partial Order
    data type
    ― RGA
    ― RHA
    ― TreeDoc
    ― Logoot
    ― WOOT
    ― WOOTH

    View full-size slide

  37. (Not) Many implementations ← CRDT
    ― Apache Cassandra
    ― Apache HBase
    ― Basho Riak
    ― SoundCloud Roshi
    ― Akka CRDT

    View full-size slide

  38. Q/A ← CRDT
    @9seconds   
    https://speakerdeck.com/9seconds/crdt-101

    View full-size slide