SlideShare a Scribd company logo
Consistency without consensus:

CRDTs in production at SoundCloud
InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
http://www.infoq.com/presentations
/crdt-soundcloud
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Presented at QCon San Francisco
www.qconsf.com
Consistency without consensus:

CRDTs in production at SoundCloud
Me
Some guy
Embedded, sensor networks
Distributed systems
SoundCloud infrastructure
Theory
Distributed programming
“The art of solving the same problem that 

you can solve on a single computer

using multiple computers.”

	 	 	 	 	 	 	 	 —book.mixu.net
Distributed programming
“Generally a bad idea,

best avoided.”

	 	 	 	 	 	 	 	 —me
>>> x = 1
>>> print x
1
$ curl -XPOST -d'{"val": 1}' http://db/vars/x
HTTP 502 Bad Gateway
$ curl -XGET http://db/vars/x
HTTP 503 Service Unavailable
Idioms
1980s — RPC
1990s — CORBA
2000 — CAP
Partition tolerance
“The system continues to operate
despite message loss due to network
and/or node failure.”

	 	 	 	 	 	 	 	 	 	 —book.mixu.net
Partition

tolerance
Consistency Availability
✗
CP AP
CP
Chubby, Doozer — Paxos
ZooKeeper — Zab
Consul, etcd — Raft
? — Viewstamped Replication
AP
Cassandra
Riak
Mongo
Couch
Message failure
Delayed
Dropped
Delivered out-of-order
Duplicated
CALM principle
Consistency
As
Logical
Monotonicity
ACID 2.0
Associative
Commutative
Idempotent
Distributed, sure, whatever
CRDT
Conflict-free
Replicated
Data
Type
Increment-only

counter
A'
A → A'
+
(1 + 2) + 3 = 1 + (2 + 3)
1 + 2 = 2 + 1
1 + 1 ≠ 1
∪
( 1 ∪ 2 ) ∪ 3 = 1 ∪ ( 2 ∪ 3 )
1 ∪ 2 = 2 ∪ 1
1 ∪ 1 = 1
{ }
{ }
{ }
{ }
{ }
{ }
123
{ }
{ }
{ }
123
123
{ }
{ }
{ }
123
123
{ }
{ }
{ }
123
123
123
{ }
{ }
{ }
123
123
123
{ }
{ }
{ }
123
123
123
456
{ }
{ }
{ }
123
123
123, 456
456
{ }
{ }
{ }
123
123
123, 456
✘
{ }
{ }
{ }
123
123, 456
123, 456
{ }
{ }
{ }
123
123, 456
123, 456
Read
{123, 456} ∪ {123} ∪ {123, 456} = {123, 456}

{123, 456} ∆ {123} ∆ {123, 456} = {456}
{ }
{ }
{ }
123
123, 456
123, 456
456
{ }
{ }
{ }
123, 456
123, 456
123, 456
{ }
{ }
{ }
123, 456
123, 456
123, 456
{ }
{ }
{ }
123, 456
123, 456
123, 456
Interlude —

Bending the problem
CRDTs in production
Consistency without Consensus: CRDTs in Production at SoundCloud
Event
Timestamp
Actor
Verb
Thing
Event
2014-04-01T15:16:17.187Z
snoopdogg
reposted
theeconomist/election-day
Fan out on write
༼⍢༽ ●
●●●● (•ི̛ᴗ•̛)ྀ
●●● ༼•͟ ͜•༽
●●●●● (ಠ_ಠ)
●
●
●
●
Fan in on read
༼⍢༽ •••••
(•ི̛ᴗ•̛)ྀ
༼•͟ ͜•༽
(ಠ_ಠ)
[¬º-°] •••
••••••
Unique events — use a set
G-set — can’t delete
2P-set — add, remove once
OR-set — storage overhead
A wild set appears
Roshi set
S+ { A/1 B/2 C/3 }
S– { D/4 }
S { A B C }
Roshi set
S = actor’s outbox key

snoopdogg·outbox
A/B/C/D = actor+verb+thing

snoopdogg·repost·theeconomist/election-day
1/2/3 = timestamp

2014-04-01T15:16:17.187Z
Reading is easy
Writing is interesting
Insert
• If either key+ or key– already contains element,

and the existing score >= score,

no-op and exit.
• Insert (element, score) into add set key+.
• Delete (element) from remove set key–.
Delete
• If either key+ or key– already contains element,

and the existing score >= score,

no-op and exit.
• Insert (element, score) into add set key–.
• Delete (element) from remove set key+.
Example
S+ { A/1 B/2 }
S– { C/3 }
S+ { A/1 B/2 }
S– { C/3 }
Insert D/4
S+ { A/1 B/2 D/4 }
S– { C/3 }
Insert D/4
S+ { A/1 B/2 D/4 }
S– { C/3 }
S+ { A/1 B/2 D/4 }
S– { C/3 }
Insert D/4
S+ { A/1 B/2 D/4 }
S– { C/3 }
Insert D/4
S+ { A/1 B/2 D/4 }
S– { C/3 }
S+ { A/1 B/2 D/4 }
S– { C/3 }
Delete D/3
S+ { A/1 B/2 D/4 }
S– { C/3 }
Delete D/3
S+ { A/1 B/2 D/4 }
S– { C/3 }
S+ { A/1 B/2 D/4 }
S– { C/3 }
Delete D/5
S+ { A/1 B/2 D/4 }
S– { C/3 D/5 }
Delete D/5
S+ { A/1 B/2 }
S– { C/3 D/5 }
S+ { A/1 B/2 }
S– { C/3 D/5 }
Delete D/6
S+ { A/1 B/2 }
S– { C/3 D/6 }
Delete D/6
S+ { A/1 B/2 }
S– { C/3 D/6 }
Making it real
Consistency without Consensus: CRDTs in Production at SoundCloud
Pool
Cluster
Pool
Cluster
Pool
Cluster
Pool
Cluster
Farm
Writing is easy
Reading is interesting
Pool
Cluster
Pool
Cluster
Pool
Cluster
Farm
Pool
Cluster
Pool
Cluster
Pool
Cluster
Farm
ClusterCluster Cluster
{A B C} {A C} {A B C}
∪ = {A B C}
∆ = {B}
Pool
Cluster
Pool
Cluster
Pool
Cluster
Farm
github.com/soundcloud/roshi
In conclusion,
Consistency without consensus = CRDT.

Embrace your invariants.

Maybe bend your problem, not your solution.
Thanks!
soundcloud.com/jobs
@peterbourgon
☞ ☜
Watch the video with slide synchronization on
InfoQ.com!
http://www.infoq.com/presentations/crdt-
soundcloud

More Related Content

KEY
Eventually-Consistent Data Structures
KEY
Eventually Consistent Data Structures (from strangeloop12)
PPTX
Quick sort algorithm using slide presentation , Learn selection sort example ...
PDF
CRDTs for engineers
ODP
Akka Persistence | Event Sourcing
PPTX
Expert Fridays - Сергей Укустов: "CRDT"
PDF
Kyo - Functional Scala 2023.pdf
PDF
COCOA: Communication-Efficient Coordinate Ascent
Eventually-Consistent Data Structures
Eventually Consistent Data Structures (from strangeloop12)
Quick sort algorithm using slide presentation , Learn selection sort example ...
CRDTs for engineers
Akka Persistence | Event Sourcing
Expert Fridays - Сергей Укустов: "CRDT"
Kyo - Functional Scala 2023.pdf
COCOA: Communication-Efficient Coordinate Ascent

Similar to Consistency without Consensus: CRDTs in Production at SoundCloud (20)

PDF
Apache Spark - Data intensive processing in practice
PPT
Music Recommender Systems
PDF
The ARK Identifier Scheme at Ten Years Old
PDF
Guaranteeing Consensus in Distriubuted Systems with CRDTs
PPTX
LalitBDA2015V3
PDF
Dataframes in Spark - Data Analysts' perspective
PDF
Streaming Auto-scaling in Google Cloud Dataflow
PDF
Apache Spark Data intensive processing in practice
PDF
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Data Provenance Support in...
PPTX
Relational Database to Apache Spark (and sometimes back again)
PDF
Community-driven Language Design at TC39 on the JavaScript Pipeline Operator ...
PDF
Clustering techniques
PDF
The Dynamic Language is not Enough
PDF
Optimizing the Catalyst Optimizer for Complex Plans
PDF
Hailey_Database_Performance_Made_Easy_through_Graphics.pdf
PDF
User Defined Aggregation in Apache Spark: A Love Story
PDF
User Defined Aggregation in Apache Spark: A Love Story
PDF
Yael Elmatad, Senior Data Scientist, Tapad at MLconf NYC - 4/15/16
PDF
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Apache Spark - Data intensive processing in practice
Music Recommender Systems
The ARK Identifier Scheme at Ten Years Old
Guaranteeing Consensus in Distriubuted Systems with CRDTs
LalitBDA2015V3
Dataframes in Spark - Data Analysts' perspective
Streaming Auto-scaling in Google Cloud Dataflow
Apache Spark Data intensive processing in practice
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Data Provenance Support in...
Relational Database to Apache Spark (and sometimes back again)
Community-driven Language Design at TC39 on the JavaScript Pipeline Operator ...
Clustering techniques
The Dynamic Language is not Enough
Optimizing the Catalyst Optimizer for Complex Plans
Hailey_Database_Performance_Made_Easy_through_Graphics.pdf
User Defined Aggregation in Apache Spark: A Love Story
User Defined Aggregation in Apache Spark: A Love Story
Yael Elmatad, Senior Data Scientist, Tapad at MLconf NYC - 4/15/16
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Ad

More from C4Media (20)

PDF
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
PDF
Next Generation Client APIs in Envoy Mobile
PDF
Software Teams and Teamwork Trends Report Q1 2020
PDF
Understand the Trade-offs Using Compilers for Java Applications
PDF
Kafka Needs No Keeper
PDF
High Performing Teams Act Like Owners
PDF
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
PDF
Service Meshes- The Ultimate Guide
PDF
Shifting Left with Cloud Native CI/CD
PDF
CI/CD for Machine Learning
PDF
Fault Tolerance at Speed
PDF
Architectures That Scale Deep - Regaining Control in Deep Systems
PDF
ML in the Browser: Interactive Experiences with Tensorflow.js
PDF
Build Your Own WebAssembly Compiler
PDF
User & Device Identity for Microservices @ Netflix Scale
PDF
Scaling Patterns for Netflix's Edge
PDF
Make Your Electron App Feel at Home Everywhere
PDF
The Talk You've Been Await-ing For
PDF
Future of Data Engineering
PDF
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Next Generation Client APIs in Envoy Mobile
Software Teams and Teamwork Trends Report Q1 2020
Understand the Trade-offs Using Compilers for Java Applications
Kafka Needs No Keeper
High Performing Teams Act Like Owners
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Service Meshes- The Ultimate Guide
Shifting Left with Cloud Native CI/CD
CI/CD for Machine Learning
Fault Tolerance at Speed
Architectures That Scale Deep - Regaining Control in Deep Systems
ML in the Browser: Interactive Experiences with Tensorflow.js
Build Your Own WebAssembly Compiler
User & Device Identity for Microservices @ Netflix Scale
Scaling Patterns for Netflix's Edge
Make Your Electron App Feel at Home Everywhere
The Talk You've Been Await-ing For
Future of Data Engineering
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Ad

Recently uploaded (20)

PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
Advanced Soft Computing BINUS July 2025.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
NewMind AI Monthly Chronicles - July 2025
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Empathic Computing: Creating Shared Understanding
20250228 LYD VKU AI Blended-Learning.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Reach Out and Touch Someone: Haptics and Empathic Computing
[발표본] 너의 과제는 클라우드에 있어_KTDS_김동현_20250524.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Machine learning based COVID-19 study performance prediction
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
Advanced Soft Computing BINUS July 2025.pdf
Network Security Unit 5.pdf for BCA BBA.
Mobile App Security Testing_ A Comprehensive Guide.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
GamePlan Trading System Review: Professional Trader's Honest Take
Diabetes mellitus diagnosis method based random forest with bat algorithm
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Review of recent advances in non-invasive hemoglobin estimation
NewMind AI Monthly Chronicles - July 2025

Consistency without Consensus: CRDTs in Production at SoundCloud