cap theorem
DESCRIPTION
CAP Theorem. Justin DeBrabant. Properties of Distributed Systems. Consistency all nodes have up-to-date view of data Availability every request receives a response Partition Tolerance system will continue to function if partitions are isolated from each other - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: CAP Theorem](https://reader035.vdocuments.us/reader035/viewer/2022070420/56815f55550346895dce35a1/html5/thumbnails/1.jpg)
CIS 570 - Advanced Systems - Fall 2013
CAP Theorem
Justin DeBrabant
![Page 2: CAP Theorem](https://reader035.vdocuments.us/reader035/viewer/2022070420/56815f55550346895dce35a1/html5/thumbnails/2.jpg)
CIS 570 - Advanced Systems - Fall 2013
Properties of Distributed Systems
• Consistency – all nodes have up-to-date view of data
• Availability – every request receives a response
• Partition Tolerance– system will continue to function if partitions are
isolated from each other• Question: Is there a tradeoff here?
![Page 3: CAP Theorem](https://reader035.vdocuments.us/reader035/viewer/2022070420/56815f55550346895dce35a1/html5/thumbnails/3.jpg)
CIS 570 - Advanced Systems - Fall 2013
ACID• Atomicity – all or nothing
• Consistency – data is always in a valid state
• Isolation – concurrently executing transactions are isolated
• Durability – once committed, changes made by transaction are
permanent
![Page 4: CAP Theorem](https://reader035.vdocuments.us/reader035/viewer/2022070420/56815f55550346895dce35a1/html5/thumbnails/4.jpg)
CIS 570 - Advanced Systems - Fall 2013
BASE
• Basically Available Soft-state Eventual Consistency – Forfeits the “C” and “I” of ACID in return for
availability – most NoSQL systems provide BASE instead of ACID
guarantees
![Page 5: CAP Theorem](https://reader035.vdocuments.us/reader035/viewer/2022070420/56815f55550346895dce35a1/html5/thumbnails/5.jpg)
CIS 570 - Advanced Systems - Fall 2013
ACID vs. BASE
• ACID– Focuses on consistency and isolation
• BASE– weak consistency • data can be stale
– availability first– simpler implementation– faster• is this always true?
![Page 6: CAP Theorem](https://reader035.vdocuments.us/reader035/viewer/2022070420/56815f55550346895dce35a1/html5/thumbnails/6.jpg)
CIS 570 - Advanced Systems - Fall 2013
CAP Theorem
• “At most two.”– you can have at most two of the CAP properties
for any shared data system• Disclaimer: – some question the assumptions used to prove the
“theorem”– thoughts?
![Page 7: CAP Theorem](https://reader035.vdocuments.us/reader035/viewer/2022070420/56815f55550346895dce35a1/html5/thumbnails/7.jpg)
CIS 570 - Advanced Systems - Fall 2013
![Page 8: CAP Theorem](https://reader035.vdocuments.us/reader035/viewer/2022070420/56815f55550346895dce35a1/html5/thumbnails/8.jpg)
CIS 570 - Advanced Systems - Fall 2013
Consistency + Availability
• Give up partitions • Characteristics – two-phase commit– cache validation protocols
• Example– single-site databases
![Page 9: CAP Theorem](https://reader035.vdocuments.us/reader035/viewer/2022070420/56815f55550346895dce35a1/html5/thumbnails/9.jpg)
CIS 570 - Advanced Systems - Fall 2013
Consistency + Partitions
• Give up availability • Characteristics – pessimistic locking
• Example– distributed databases
![Page 10: CAP Theorem](https://reader035.vdocuments.us/reader035/viewer/2022070420/56815f55550346895dce35a1/html5/thumbnails/10.jpg)
CIS 570 - Advanced Systems - Fall 2013
Availability + Partitions
• Give up consistency • Characteristics – optimistic concurrency control– conflict resolution protocols
• Example– web caching– DNS– NoSQL systems
![Page 11: CAP Theorem](https://reader035.vdocuments.us/reader035/viewer/2022070420/56815f55550346895dce35a1/html5/thumbnails/11.jpg)
CIS 570 - Advanced Systems - Fall 2013
Take-Homes• In real-world systems, there are (probably)
tradeoffs• Which do you tradeoff? – depends on…
• workload• data• users
– requires a deep understanding of the choices available • In reality, systems all along this spectrum are
useful in different ways
![Page 12: CAP Theorem](https://reader035.vdocuments.us/reader035/viewer/2022070420/56815f55550346895dce35a1/html5/thumbnails/12.jpg)
CIS 570 - Advanced Systems - Fall 2013
Questions?