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
890
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Convergent Replicated Data Types
Patrick Van Stee
December 14, 2012
More Decks by Patrick Van Stee
See All by Patrick Van Stee
Raft: Consensus for Rubyists
vanstee
141
7.7k
Elixir and Ecto
vanstee
5
1k
Bootstrap
vanstee
8
850
HTTP API Design for iOS Applications
vanstee
11
720
Consensus: An Introduction to Raft
vanstee
21
3.3k
Pour Over Brewing Method
vanstee
1
430
Celluloid & DCell
vanstee
4
620
Map Reduce & Ruby
vanstee
10
930
Other Decks in Programming
See All in Programming
freee が目指す データ マネジメント戦略 AI-Ready 時代を支える 攻めのガバナンスとは
freee
PRO
0
540
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
470
プロポーザルを書いてもらう
pvcresin
0
590
React本体のコードリーディング
high_g_engineer
1
160
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
670
AI駆動開発にグラフDBを重ねてみた
satoshi256kbyte
2
430
バグを直したら useEffect が消えた
colorful12
3
780
高専、大学編入、そして未踏へ〜プロダクト開発とキャリアの歩み - Technical College, University Transfer, and On to “Mitou” / My Journey in Product Development and Career
pkmiya
0
110
MySQLとPostgreSQLって何が違うの?
akagami
0
150
高専キャリア LT 発表内容
crysta1221
6
5k
PyConJP2026_wat_Python × Signal Processing: How to Draw Pictures with Sound Using Spectrogram Art
wat
0
590
実装をデザインガイドラインに追従させるための取り組み / 260731-dip-mosh-design-system
dachi023
0
8k
Featured
See All Featured
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
480
The Invisible Side of Design
smashingmag
301
52k
Un-Boring Meetings
codingconduct
0
400
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
430
The SEO Collaboration Effect
kristinabergwall1
1
540
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Become a Pro
speakerdeck
PRO
31
6.2k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Context Engineering - Making Every Token Count
addyosmani
9
1.1k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
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