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
850
4
Share
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.4k
Elixir and Ecto
vanstee
5
990
Bootstrap
vanstee
8
830
HTTP API Design for iOS Applications
vanstee
11
690
Consensus: An Introduction to Raft
vanstee
21
3.1k
Pour Over Brewing Method
vanstee
1
400
Celluloid & DCell
vanstee
4
600
Map Reduce & Ruby
vanstee
10
880
Other Decks in Programming
See All in Programming
t *testing.T は どこからやってくるの?
otakakot
0
290
The Monolith Strikes Back: Why AI Agents ❤️ Rails Monoliths
serradura
0
320
Go_College_最終発表資料__外部公開用_.pdf
xe_pc23
0
200
PCOVから学ぶコードカバレッジ #phpcon_odawara
o0h
PRO
0
260
Swift Concurrency Type System
inamiy
0
490
PHPで TLSのプロトコルを実装してみるをもう一度しゃべりたい
higaki_program
0
200
TiDBのアーキテクチャから学ぶ分散システム入門 〜MySQL互換のNewSQLは何を解決するのか〜 / tidb-architecture-study
dznbk
1
170
2026-03-27 #terminalnight 変数展開とコマンド展開でターミナル作業をスマートにする方法
masasuzu
0
330
存在論的プログラミング: 時間と存在を記述する
koriym
5
870
アーキテクチャモダナイゼーションとは何か
nwiizo
17
5k
ローカルで稼働するAI エージェントを超えて / beyond-local-ai-agents
gawa
3
270
Mastering Event Sourcing: Your Parents Holidayed in Yugoslavia
super_marek
0
150
Featured
See All Featured
Chasing Engaging Ingredients in Design
codingconduct
0
170
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
From π to Pie charts
rasagy
0
160
The Curse of the Amulet
leimatthew05
1
11k
The Cost Of JavaScript in 2023
addyosmani
55
9.8k
Code Reviewing Like a Champion
maltzj
528
40k
Docker and Python
trallard
47
3.8k
How GitHub (no longer) Works
holman
316
150k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
110
A Soul's Torment
seathinner
6
2.6k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Accessibility Awareness
sabderemane
0
99
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