SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 

Destacado

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

CRDTs for engineers