Consensus in distributed systems has been a debated topic every since programmers discovered they could run the same program on multiple machines. Researchers have been studying consensus for decades, resulting in numerous algorithms and white papers. Unfortunately, many of these algorithms are flawed and unreliable.
However, in 2011, a team of researchers published a paper on a novel approach to distributed consensus using Conflict-free Replicated Data Types (https://hal.inria.fr/inria-00609399v1...). This paper created quite a buzz as it showed that CRDTs were mathematically proven to guarantee consensus through "Strong Eventual Consistency." They also claimed to have solved the CAP conundrum.
This presentation dives into this seminal paper in order to answer the hard questions. What are CRDTs? How do they work? And most importantly, does it actually solve CAP? By the end of this talk, everyone in the audience will have a foundational understanding of CRDTs and how they can be applied to their own work.
Best of all, I will be explaining all of this is as simple language as possible. No advanced math degree required! Sound too good to be true? You'll just have to come see for yourself!
15. Possible consensus algorithms
● Manual override conflicts/rollback (Git)
● Pick one set of changes, throw out the rest (Blockchain)
@SunnyPaxos
16. Possible consensus algorithms
● Manual override conflicts/rollback (Git)
● Pick one set of changes, throw out the rest (Blockchain)
● Dynamically merge conflicts based on user intention
@SunnyPaxos
71. Three Requirements for SEC
● Commutativity
A given set of operations will always result in same state, no matter their
order.
Example: 1 + 5 = 5 + 1
@SunnyPaxos
72. Three Requirements for SEC
● Commutativity (1 + 5 = 5 + 1)
● Idempotency
Duplicate operations result in the same state
Example: x * 1 = x
@SunnyPaxos
73. ● Commutativity (1 + 5 = 5 + 1)
● Idempotency (x * 1 = x)
● Associativity or Causality
Three Requirements for SEC
@SunnyPaxos
96. Version Vector
Node A Node B
@SunnyPaxos
Node Count
A 1
B 0
Node Count
A 0
B 0
Add(1)
NodeID: A
Count: 1
97. Version Vector
Node A Node B
@SunnyPaxos
Node Count
A 1
B 0
Node Count
A 1
B 0
Add(1)
NodeID: A
Count: 1
98. { 10, 11, ... }
So instead of a Set like this...
@SunnyPaxos
99. { (10, {A: 1}), (11, {B: 1}), ... }
...it will look like this
@SunnyPaxos
100. { (10, {A: 1}), (11, {B: 1}), ... }
@SunnyPaxos
Element Value
...it will look like this
101. { (10, {A: 1}), (11, {B: 1}), ... }
@SunnyPaxos
Element Value Lamport
Timestamp
...it will look like this
102. Node A
Node B Node C
A: 0
B: 0
Version Vector
Node Count
A 0
B 0
@SunnyPaxos
State: {}
103. Node A
Node B Node C
Add(5)
- NodeID: A
- Counter: 1A: 1
B: 0
Version Vector
Node Count
A 0
B 0
@SunnyPaxos
State: { (5, {A: 1} }
104. Node A
Node B Node C
Remove(5)
- NodeID: B
- Counter: 1
A: 1
B: 1
Add(5)
- NodeID: A
- Counter: 1 Version Vector
Node Count
A 0
B 0
@SunnyPaxos
State: {}
105. Node A
Node B Node C
Add(5)
- NodeID: A
- Counter: 1
Remove(5)
- NodeID: B
- Counter: 1
Version Vector
Node Count
A 0
B 0
A: 1
B: 1
@SunnyPaxos
State: {}
106. Node A
Node B Node C
Version Vector
Node Count
A 0
B 0
Remove(5)
- NodeID: B
- Counter: 1
Add(5)
- NodeID: A
- Counter: 1
A: 1
B: 1
@SunnyPaxos
State: {}
123. CRDTs in a nutshell
● Decentralized data store
● Strong Eventual Consistency
● 3 requirements for SEC
○ Commutativity
○ Idempotency
○ Associativity/Causality
● Any data structure can be a CRDT (w/ enough effort)
@SunnyPaxos