Liz Howard
August 21, 2013

# CAP Theorem

A basic overview of the problems facing distributed systems for Hackbright Girl Geek Dinner

August 21, 2013

## Transcript

1. ### I’m @lizTheDeveloper Director of Operations Instructor / Developer @Hackbright Academy

Wednesday, August 21, 13

4. ### What is CAP Theorem? Comes into play when we start

to want to replicate databases Wednesday, August 21, 13

6. ### What is CAP Theorem? Consistency Database behaves as though we

have a single, constantly up-to-date copy of the data Wednesday, August 21, 13

8. ### What is CAP Theorem? Availability We can always read and

write that data Wednesday, August 21, 13

21, 13
10. ### What is CAP Theorem? Tolerance to Network Partitions What happens

when part of the database isn’t accessible? Wednesday, August 21, 13
11. ### What is CAP Theorem? Tolerance to Network Partitions What happens

when part of the database isn’t accessible? Partitions are inevitable Wednesday, August 21, 13

13. ### Why is CAP Theorem important? Understanding how distributed systems work

Wednesday, August 21, 13
14. ### Why is CAP Theorem important? Understanding how distributed systems work

How to make things work at scale Wednesday, August 21, 13
15. ### Why is CAP Theorem important? Understanding how distributed systems work

How to make things work at scale Knowing what limits exist, and why Wednesday, August 21, 13

17. ### ACID Atomicity : A group of transactions that succeed completely

or fail completely Wednesday, August 21, 13
18. ### ACID Atomicity : A group of transactions that succeed completely

or fail completely Example: Booking a ﬂight Wednesday, August 21, 13
19. ### ACID Atomicity : A group of transactions that succeed completely

or fail completely Example: Booking a ﬂight Reserve a seat and collect money XOR Wednesday, August 21, 13
20. ### ACID Atomicity : A group of transactions that succeed completely

or fail completely Example: Booking a ﬂight Reserve a seat and collect money XOR Do not reserve a seat, nor collect money Wednesday, August 21, 13
21. ### ACID Consistency : A transaction will bring the database from

one valid state to another - all of the “rules” of the database Example: Unique Primary Keys Wednesday, August 21, 13
22. ### ACID Isolation : If two things happen at the same

time, the system must look the same as if those two things happened sequentially Wednesday, August 21, 13
23. ### ACID Isolation : If two things happen at the same

time, the system must look the same as if those two things happened sequentially Example: Incrementing a number Wednesday, August 21, 13
24. ### ACID Isolation : If two things happen at the same

time, the system must look the same as if those two things happened sequentially Example: Incrementing a number If two operations add 1 to a number, that number should go up by two, rather than only 1. Wednesday, August 21, 13
25. ### ACID Durability: Once changes are posted, they remain so, even

in the event of power loss or other serious unpredictable but inevitable problems. Wednesday, August 21, 13
26. ### ACID Durability: Example: Buying something with a debit card Once

changes are posted, they remain so, even in the event of power loss or other serious unpredictable but inevitable problems. Wednesday, August 21, 13
27. ### ACID Durability: Example: Buying something with a debit card Money

is taken away from my account, and given to the merchant account - even if power is lost between those two events. Once changes are posted, they remain so, even in the event of power loss or other serious unpredictable but inevitable problems. Wednesday, August 21, 13

29. ### Think of a partition as latency Failing to get to

Consistency within an arbitrary amount of time means that you’re in “partition mode” Wednesday, August 21, 13
30. ### Think of a partition as latency Failing to get to

Consistency within an arbitrary amount of time means that you’re in “partition mode” This happens often over a wide area, which is why most people opt for Eventual Consistency Wednesday, August 21, 13

13
33. ### BASE (A mnemonic more than an acronym) Basically Available Wednesday,

August 21, 13
34. ### BASE (A mnemonic more than an acronym) Basically Available Soft

State Wednesday, August 21, 13
35. ### BASE (A mnemonic more than an acronym) Basically Available Soft

State Eventually Consistent Wednesday, August 21, 13