cap theorem justin debrabant cis 570 - advanced systems - fall 2013
TRANSCRIPT
CIS 570 - Advanced Systems - Fall 2013
CAP Theorem
Justin DeBrabant
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?
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
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
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?
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?
CIS 570 - Advanced Systems - Fall 2013
CIS 570 - Advanced Systems - Fall 2013
Consistency + Availability
• Give up partitions • Characteristics – two-phase commit– cache validation protocols
• Example– single-site databases
CIS 570 - Advanced Systems - Fall 2013
Consistency + Partitions
• Give up availability • Characteristics – pessimistic locking
• Example– distributed databases
CIS 570 - Advanced Systems - Fall 2013
Availability + Partitions
• Give up consistency • Characteristics – optimistic concurrency control– conflict resolution protocols
• Example– web caching– DNS– NoSQL systems
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
CIS 570 - Advanced Systems - Fall 2013
Questions?