Database
Database systems designed with traditional ACID guarantees in mind such as RDBMS choose consistency over availability, whereas systems designed around the BASE philosophy, common in the NoSQL movement for example, choose availability over consistency.
CRUD
create, read, update, and delete (as an acronym CRUD) are the four basic functions of persistent storage.
ACID
ACID is a set of properties of database transactions intended to guarantee validity even in the event of errors.
- Atomicity requires that each transaction be "all or nothing". A guarantee of atomicity prevents updates to the database occurring only partially, should reject the whole series outright.
- Consistency ensures that any transaction will bring the database from one valid state to another. If a validation is a requirement that A + B = 100, when a transaction shows that A + B = 90, the entire transaction must be cancelled and the affected rows rolled back to their pre-transaction state.
- Isolation ensures that the concurrent execution of transactions results in a system state that would be obtained if transactions were executed sequentially. When two transactions execute at the same time, each attempting to modify the same data. If these operations are performed in order, isolation is maintained, although next one must wait.
- Durability ensures that once a transaction has been committed, it will remain so, even in the event of power loss. For instance, once a group of SQL statements execute, the results need to be stored permanently even if the database crashes immediately thereafter.
CAP theorem
CAP states that it is impossible for a distributed data store to simultaneously provide more than two out of the following three guarantees:
- Consistency
- Availability
- Partition tolerance
In other words, the CAP theorem states that in the presence of a network partition, one has to choose between consistency and availability. CAP is frequently misunderstood as if one had to choose to abandon one of the three guarantees at all times. In fact, the choice is really between consistency and availability only when a network partition or failure happens.
Note that consistency as defined in the CAP is quite different from the consistency guaranteed in ACID.
BASE
BASE (Basically Available, Soft state, Eventual consistency) semantics, in contrast to traditional ACID guarantees. BASE is sometimes criticized as purely a liveness guarantee (reads eventually return the same value) and does not make safety guarantees, an eventually consistent system can return any value before it converges.