basho
"Oh, you wanted to
*increment a counter*?!
Good luck with that!” [1]
Russell Brown
[email protected]
[1] https://twitter.com/lindsey/status/575006945213485056
basho
Leslie Lamport
``A distributed system is one in
which the failure of a computer
you didn't even know existed can
render your own computer
unusable''
Slide 11
Slide 11 text
basho
https://en.wikipedia.org/wiki/Distributed_computing
A distributed system is a software
system in which components located
on networked computers
communicate and coordinate their
actions by passing messages. The
components interact with each other
in order to achieve a common goal.
Slide 12
Slide 12 text
basho
Distributed Counters - WHY?
• Many many updates - scale/perf
• Fault tolerance - machines crash
• Latency - local data centres
• Containers/“microservices”
Slide 13
Slide 13 text
basho
CAP
CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP
CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP
CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP
CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP
CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP
CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP
CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP
CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP
CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP
CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP CAP
Slide 14
Slide 14 text
basho
CAP
• Consistency
• Availability
• Partition Tolerance
Slide 15
Slide 15 text
Replica A Replica B Replica C
Client X Client Y
add 1
add 1
NO!!!! :(
CP
Slide 16
Slide 16 text
Replica A Replica B Replica C
Client X Client Y
Add 1
C’
Add 1
AP
Slide 17
Slide 17 text
basho
Why Are You Counting?
• Money / Votes
• Real world resources (seats on a place, rental cars)
• Unique IDs
• Events (likes, hits, plays)
Slide 18
Slide 18 text
basho
“Strong Consistency”
• ZooKeeper/HyperDex-Replicant/Riak-Ensemble
• ZAB/Chain Replication/Paxos/Raft/VSR
• Compare and swap
• Starvation
• Single data centre
basho
Take Home
• Understand your requirements
• Know What you are counting and WHY
• Understand the trade offs
• Make them consciously
• Chose the least consistency/accuracy your use
case allows