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
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Patrick Van Stee
December 14, 2012
Programming
4
850
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
141
7.4k
Elixir and Ecto
vanstee
5
990
Bootstrap
vanstee
8
820
HTTP API Design for iOS Applications
vanstee
11
680
Consensus: An Introduction to Raft
vanstee
21
3.1k
Pour Over Brewing Method
vanstee
1
390
Celluloid & DCell
vanstee
4
590
Map Reduce & Ruby
vanstee
10
880
Other Decks in Programming
See All in Programming
Understanding Apache Lucene - More than just full-text search
spinscale
0
130
OTP を自動で入力する裏技
megabitsenmzq
0
120
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
13
8.2k
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.1k
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
270
LangChain4jとは一味違うLangChain4j-CDI
kazumura
1
190
SourceGeneratorのマーカー属性問題について
htkym
0
200
CDIの誤解しがちな仕様とその対処TIPS
futokiyo
0
220
Claude Code の Skill で複雑な既存仕様をすっきり整理しよう
yuichirokato
1
410
文字コードの話
qnighy
44
17k
Cyrius ーLinux非依存にコンテナをネイティブ実行する専用OSー
n4mlz
0
180
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
400
Featured
See All Featured
The World Runs on Bad Software
bkeepers
PRO
72
12k
Site-Speed That Sticks
csswizardry
13
1.1k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
640
Color Theory Basics | Prateek | Gurzu
gurzu
0
250
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
290
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Design in an AI World
tapps
0
170
Six Lessons from altMBA
skipperchong
29
4.2k
Git: the NoSQL Database
bkeepers
PRO
432
66k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
260
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