ACID Compliance and CAP Theorem Flashcards
Explain the A in ACID Compliance
Atomicity: The entire transaction must either succeed or fail, no in between. E.g., you can’t successfully write a portion of data and have the other portion fail
Explain the C in ACID Compliance
Consistency: All the database rules are enforced. Self-explanatory, but a part nonetheless
Explain the I in ACID Compliance
Isolation: No transaction is affected by any other transaction that is still in progress
Explain the D in ACID Compliance
Durability: Once a transaction is committed, it stays, even if the system crashes immediately after
What is the CAP Theorem?
There are three features in databases: Consistency, Availability, and Partition-Tolerance. You can pick 2, but you can’t have all 3
Explain the C in the CAP Theorem
Consistency: Every read receives the most recent write or an error
Explain the A in the CAP Theorem
Availability: Every request receives a non-error response, without the guarantee that it’s the most up-to-date
Explain the P in the CAP Theorem
Partition Tolerance: The (distributed) system continues to operate despite an arbitrary number of messages dropped/delayed by network between nodes
A “partition” in this case is a comms break within a distributed system
When a network failure happens, what do you do when you want to ensure consistency?
Cancel the operation, thus decreasing availability but ensuring consistency
When a network failure happens, what do you do when you want to ensure availability?
Proceed with the operation, thus risking inconsistency but providing availability
Which of the three CAP Theorem features is typically given up in modern databases?
Availability, since scalability and data consistency are typically more important for customers