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
870
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.5k
Elixir and Ecto
vanstee
5
1k
Bootstrap
vanstee
8
840
HTTP API Design for iOS Applications
vanstee
11
710
Consensus: An Introduction to Raft
vanstee
21
3.2k
Pour Over Brewing Method
vanstee
1
420
Celluloid & DCell
vanstee
4
600
Map Reduce & Ruby
vanstee
10
900
Other Decks in Programming
See All in Programming
タクシーアプリ『GO』の バックエンド開発のおける AI利活用と若者のすべて
pyama86
3
2k
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
160
Claspは野良GASの夢をみるか
takter00
0
190
Agentic UI
manfredsteyer
PRO
0
160
エンジニアと一緒にテストコードの設計と実装を改善した話
mototakatsu
0
170
net-httpのHTTP/2対応について
naruse
0
480
Developing with AI Agents — Codex, Claude Code & Cowork Practical Guide
x5gtrn
PRO
0
1.3k
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
250
JavaDoc 再入門
nagise
1
340
AIで効率化できた業務・日常
ochtum
0
130
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
13
4k
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
2
640
Featured
See All Featured
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
390
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
780
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
230
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
720
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
400
sira's awesome portfolio website redesign presentation
elsirapls
0
280
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
210
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
300
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
44k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
240
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
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