ACID vs BASE
BASE: the alternative to ACID
Many NoSQL systems weaken ACID properties. The result is often called BASE transactions (a deliberate pun on ACID):
| Letter | Term | Meaning |
|---|---|---|
| BA | Basically Available | Availability is promoted over consistency |
| S | Soft state | Stored values may change without any application intervention owing to eventual consistency updates or network partition |
| E | Eventual consistency | All readers throughout the system will eventually see the same state as each other |
Exactly what these terms mean varies from system to system. This is an area of ongoing research. BASE is certainly ideal for some applications, but some proponents have lost their faith and fallen back to a relational system.
The trade-off
| Property | ACID | BASE |
|---|---|---|
| Consistency | Strong, immediate | Eventual |
| Availability | May block during partitions | Prioritised |
| Performance | Lower throughput due to locking overhead | Higher throughput |
| Partition tolerance | Sacrificed in AP systems | Embraced |
| Application complexity | Low | High (app must tolerate stale reads) |
| Typical use | Banking, inventory, financial ledgers | Social media, content delivery, recommendation |
ACID provides strong guarantees but at a performance cost. BASE provides high availability and partition tolerance but sacrifices immediate consistency.
The CAP theorem
The CAP theorem (covered in Lecture 1) provides the theoretical underpinning:
You cannot simultaneously achieve Consistency, Availability, and Partition tolerance in a distributed system.
Formulated by Eric Brewer in 2000, the theorem states that at most two of the three guarantees can be provided. Since network partitions are inevitable in distributed systems, the practical choice is between:
- CP (Consistency + Partition tolerance): sacrifice availability. The system may refuse requests during a partition to preserve consistency. Example: traditional RDBMS with synchronous replication.
- AP (Availability + Partition tolerance): sacrifice consistency. The system continues serving requests even if replicas diverge. Example: DynamoDB, Cassandra.
A system sits on an edge, never at the centre.
BASE in practice
In a BASE system, after an update:
- Some replicas receive the update immediately.
- Other replicas lag behind, serving stale data.
- Over time, all replicas converge to the same state.
- The application must be written to cope with stale reads.
Summary
- ACID and BASE represent opposite ends of a consistency spectrum.
- The CAP theorem formalises why you cannot have everything in a distributed system.
- ACID prioritises consistency; BASE prioritises availability.
- The choice depends on the application’s tolerance for stale data.