Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Convergent Replicated Data Types
Search
Patrick Van Stee
December 14, 2012
Programming
4
720
Convergent Replicated Data Types
Patrick Van Stee
December 14, 2012
Tweet
Share
More Decks by Patrick Van Stee
See All by Patrick Van Stee
Raft: Consensus for Rubyists
vanstee
137
6.8k
Elixir and Ecto
vanstee
5
900
Bootstrap
vanstee
8
760
HTTP API Design for iOS Applications
vanstee
11
600
Consensus: An Introduction to Raft
vanstee
22
2.9k
Pour Over Brewing Method
vanstee
1
330
Celluloid & DCell
vanstee
4
530
Map Reduce & Ruby
vanstee
10
760
Other Decks in Programming
See All in Programming
PHPUnit 高速化テクニック / PHPUnit Speedup Techniques
pinkumohikan
1
530
Denoでフロントエンド開発 2025年春版 / Frontend Development with Deno (Spring 2025)
petamoriken
0
1.2k
はじめてのIssueOps - GitHub Actionsで実現するコメント駆動オペレーション
tmknom
7
2.1k
なぜselectはselectではないのか
taiyow
2
170
Introduction to C Extensions
sylph01
3
150
SLI/SLOの設定を進めるその前に アラート品質の改善に取り組んだ話
tanden
2
340
ローコードサービスの進化のためのモノレポ移行
taro28
1
240
アーキテクトと美学 / Architecture and Aesthetics
nrslib
10
2.3k
CSC486 Lecture 14
javiergs
PRO
0
140
クックパッド検索システム統合/Cookpad Search System Consolidation
giga811
0
240
生産性アップのためのAI個人活用
kunoyasu
0
450
バックエンドNode.js × フロントエンドDeno で開発して得られた知見
ayame113
4
1.2k
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
67
11k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.1k
The Cult of Friendly URLs
andyhume
78
6.3k
Embracing the Ebb and Flow
colly
84
4.6k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
28
2k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
12k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
30
4.7k
Bash Introduction
62gerente
611
210k
BBQ
matthewcrist
87
9.5k
Gamification - CAS2011
davidbonilla
80
5.2k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.2k
Optimizing for Happiness
mojombo
377
70k
Transcript
Convergent Replicated Data Types
@vanstee
[email protected]
Patrick Van Stee
“Structuring data so conflict resolution is automatic”
Dynamo Trade consistency for availability and partition tolerance
Node 1 Node 2 { a: “200” } { a:
“-3000” } :(
Node 1 Node 2 { a: “200” } { a:
“-3000” } { a: “200”, a: “-3000” } Riak
CRDT •Counter •Set •Graph •List •Tree
CRDT •Counter •Set •Graph •List •Tree
Counter •Can only be increased •Merge: use largest value
Chat Room Karma Fault-Tolerant Distributed
Serious Business { SB[PVS]: 0} Serious Coding { SB[PVS]: 1}
# PVS++ { SC[PVS]: 0} { SC[PVS]: 5} # PVS += 5 { SB[PVS]: 2} # PVS++ Merge { SB[PVS]: 2, SC[PVS]: 5} { SB[PVS]: 1, SC[PVS]: 5} { SB[PVS]: 2, SC[PVS]: 5} { PVS: 7}
What about decrements? Use separate counters for positive and negative.
Take the difference for the result.
Serious Business { SB[PVS+]: 0, SB[PVS-]: 0 } Serious Coding
{ SB[PVS+]: 1, SB[PVS-]: 0 } # PVS++ { SB[PVS+]: 0, SB[PVS-]: 0 } { SB[PVS+]: 5, SB[PVS-]: 0 } # PVS += 5 { SB[PVS+]: 1, SB[PVS-]: 1 } # PVS-- Merge { PVS+: 6, PVS-: 1 } { PVS+: 6, PVS-: 0 } { PVS+: 6, PVS-: 1 } { PVS: 5 }
Set •Can only be added to •Merge: take the union
Serious Business { PVS: [ ] } Serious Coding {
PVS: [] } { PVS: [] } { PVS: [ ] } Merge { PVS: [ , ] } { PVS: [ , ] } { PVS: [ , , ] } { PVS: [ , , ] }
Hold on, Can we remove stuff? Use separate sets for
added and removed elements.
Serious Business { PVS+: [ ], PVS-: [] } Serious
Coding { PVS+: [], PVS-: [] } { PVS+: [], PVS-: [] } { PVS+: [ ], PVS-: [] } Merge { PVS+: [ , ], PVS-: [ ] } { PVS+: [ ], PVS-: [ ] } { PVS+: [ , ], PVS-: [] } { PVS+: [ , ], PVS-: [ ] } { PVS: [ ] }
But wait, we can only remove once?
U-Set •Append unique values to all set members •Garbage collection
becomes an issue
basho/riak_dt Demo
Use Cases •Like button •Page Views •Shopping Cart
Reference •INRIA paper •basho/riak_dt •RICON talk
Beginning Ruby on Rails Course bignerdranch.com/classes/beginning_ruby_on_rails