SlideShare ist ein Scribd-Unternehmen logo
1 von 47
CRDTs
for engineers
1Thursday, June 27, 13
CRDT
• Conflict-Free (amongst others)
• Replicated
• Data
• Type
2Thursday, June 27, 13
CRDT
• Conflict-Free (amongst others)
• Replicated
• Data - obvious
• Type - obvious
3Thursday, June 27, 13
Replicated
• Build to be used in distributed systems
• multiple replicas can be changed
concurrently
• do not require locking
4Thursday, June 27, 13
Conflict-Free
• the big one!
• replica merges with predictable behavior!
• predictable =:= desired?
5Thursday, June 27, 13
big words
• Associative
• Commutative
• Idempotent
6Thursday, June 27, 13
Associative
• operations can be applied in any order
• x ∧ (y ∧ z) = (x ∧ y) ∧ z
7Thursday, June 27, 13
Commutative
• The values of operations can be swapped.
• x ∧ y = y ∧ x
• together
• we don’t need to care about order
8Thursday, June 27, 13
Idempotent
• not impotent!
• applying twice does not change a thing.
• f(f(x)) = f(x)
9Thursday, June 27, 13
Types
• CmRDT message based
• CvRDT state based (v for vector)
• can be emulated
10Thursday, June 27, 13
CmRDT
• based on messages
• requires messages to be delivered
• needs controls of messages (complex)
11Thursday, June 27, 13
CvRDT
• Based on the objects state
• independent from underlaying structure
• that’s good!
12Thursday, June 27, 13
LWW register
VaTa VbTb
VbTb
Ta =< Tb
13Thursday, June 27, 13
G Set
M1 Merge M2
14Thursday, June 27, 13
G Set
A
M1 Merge M2
AA
15Thursday, June 27, 13
G Set
A
M1 Merge M2
AA
16Thursday, June 27, 13
G Set
A
M1 Merge M2
AA
B B
17Thursday, June 27, 13
G Set
A
M1 Merge M2
AA
B B
18Thursday, June 27, 13
G Set
A
M1 Merge M2
AA
B B C
C
19Thursday, June 27, 13
G Set
A
M1 Merge M2
AA
B B C
C
20Thursday, June 27, 13
G Set
A
M1 Merge M2
AA
B B C
CD D
D
Union
21Thursday, June 27, 13
G Counter
Master 1
Master 2
Master 3
0 0 0
0 0 0
0 0 0
M1 M2 Merge
0
0
0
M3
0 0 0 0
= Max
= Max
= Max
SumSumSumSum
22Thursday, June 27, 13
G Counter
Master 1
Master 2
Master 3
1 1 1
0 0 0
0 0 0
M1 M2 Merge
1
0
0
M3
1 1 1 1
= Max
= Max
= Max
SumSumSumSum
23Thursday, June 27, 13
G Counter
Master 1
Master 2
Master 3
1 1 1
4 4 4
0 0 0
M1 M2 Merge
1
4
0
M3
5 5 5 5
= Max
= Max
= Max
SumSumSumSum
24Thursday, June 27, 13
G Counter
Master 1
Master 2
Master 3
1 1 1
4 4 4
0 0 0
M1 M2 Merge
1
4
0
M3
5 5 5 5
= Max
= Max
= Max
SumSumSumSum
25Thursday, June 27, 13
G Counter
Master 1
Master 2
Master 3
1 1 1
4 4 4
5 0 5
M1 M2 Merge
1
4
5
M3
10 5 10 10
= Max
= Max
= Max
SumSumSumSum
26Thursday, June 27, 13
G Counter
Master 1
Master 2
Master 3
1 1 1
4 4 4
5 0 5
M1 M2 Merge
1
4
5
M3
10 5 10 10
= Max
= Max
= Max
SumSumSumSum
27Thursday, June 27, 13
G Counter
Master 1
Master 2
Master 3
1 1 1
4 4 4
5 0 5
M1 M2 Merge
1
4
5
M3
10 5 10 10
= Max
= Max
= Max
SumSumSumSum
28Thursday, June 27, 13
G Counter
Master 1
Master 2
Master 3
1 1 1
4 4 4
5 7 7
M1 M2 Merge
1
4
7
M3
10 12 12 12
= Max
= Max
= Max
SumSumSumSum
29Thursday, June 27, 13
G Counter
Master 1
Master 2
Master 3
1 1 1
4 4 4
5 7 7
M1 M2 Merge
1
4
7
M3
10 12 12 12
= Max
= Max
= Max
SumSumSumSum
30Thursday, June 27, 13
now it’s like lego
31Thursday, June 27, 13
PN Counter
Increments Decrements
G Counter G Counter
32Thursday, June 27, 13
2P Set
Additions Deletions
G Set G Set
33Thursday, June 27, 13
2P Set
• Can only be added once
• Deleted for good
34Thursday, June 27, 13
35Thursday, June 27, 13
PN Set
7 A
0 B
3 C
-2 D
PN Counter
A
C
36Thursday, June 27, 13
PN Set
• Partial merges can lead to negative values
• Adds might (temporarily) have no effect
37Thursday, June 27, 13
OR Set
M1,1 A
M1,1 A
M2,1 A
M1,2 B
M1,3 A
A
B
2P Set
38Thursday, June 27, 13
OR Set
39Thursday, June 27, 13
OR Set
M1,1 A M1,1 A A
40Thursday, June 27, 13
OR Set
M1,1 A M1,1 A A
M1,2 B B
41Thursday, June 27, 13
OR Set
M1,1 A M1,1 A A
M1,2 B BM2,1 B
42Thursday, June 27, 13
OR Set
M1,1 A M1,1 A A
M1,2 B BM2,1 B
M1,2 B
43Thursday, June 27, 13
OR Set
M1,1 A M1,1 A A
M1,2 B BM2,1 B
M1,2 B
M1,3 B
44Thursday, June 27, 13
OR Set
M1,1 A M1,1 A A
M1,2 B M2,1 B
M1,2 B
M1,3 B
M2,1 B
M1,3 B
M2,1 B
M1,3 B
45Thursday, June 27, 13
OR Set
• Elements have a unique ID
• delete
• Elements might ‘reappear’ after a merge
• lots of trash
46Thursday, June 27, 13
Questions?
• Code?
• C-x C-+
• https://github.com/Licenser/ecrdt
• more links there!
47Thursday, June 27, 13

Weitere ähnliche Inhalte

Was ist angesagt? (7)

ΙΦΕ - Μαθηματικά - Μάθημα 2 - Επαγωγή
ΙΦΕ - Μαθηματικά - Μάθημα 2 - ΕπαγωγήΙΦΕ - Μαθηματικά - Μάθημα 2 - Επαγωγή
ΙΦΕ - Μαθηματικά - Μάθημα 2 - Επαγωγή
 
Adding Numbers with Regrouping
Adding Numbers with RegroupingAdding Numbers with Regrouping
Adding Numbers with Regrouping
 
Exponential Functions
Exponential FunctionsExponential Functions
Exponential Functions
 
Shikh Mohammad Usman Haidar , BCA Third Year
Shikh Mohammad Usman Haidar , BCA Third YearShikh Mohammad Usman Haidar , BCA Third Year
Shikh Mohammad Usman Haidar , BCA Third Year
 
Ch 5-integration-part-1
Ch 5-integration-part-1Ch 5-integration-part-1
Ch 5-integration-part-1
 
Tugas matematika 1 (semester 2) - Mencari Turunan
Tugas matematika 1 (semester 2) - Mencari TurunanTugas matematika 1 (semester 2) - Mencari Turunan
Tugas matematika 1 (semester 2) - Mencari Turunan
 
Adding Without Regrouping
Adding Without RegroupingAdding Without Regrouping
Adding Without Regrouping
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

CRDTs for engineers