Semester 3Computer Architecture
ACID vs BASE
ACID
used in traditional relational database approach. not so easy to scale. not performant when the tables get huge amount of records.
- Atomicity: All operations in a transaction are reflected in the database, or none
- Consistency: A transaction moves the database from one consistent state to another. Consistency is defined in terms of constraints
- Isolation: Concurrent transactions don't see each other's intermediate results. Changes are not visible until the transaction commits
- Durability: Once a transaction commits, its changes survive system failures
BASE
used in most of NOSQL Databases. this name "BASE" is chosen to reflect the opposition to the "ACID". BASE forces Partition Tolerance and Availability in CAP Theorem while relaxing consistency.
- Basically Available: The system guarantees availability of the data, in the sense of the CAP theorem
- Soft state: The system's state can change over time, even without new input, because updates are still propagating
- Eventually consistent: If the system stops receiving input, it will eventually become consistent. Data propagates everywhere it should, but the system doesn't check consistency on every transaction before moving to the next one
In a distributed system, there are plenty of ways data is delivered, thru regional databases, caches, CDNs. Once something is updated, it has to be updated everywhere but the BASE rule says, consistency is not immediately required. So the updates will happen asynchronously across all data nodes eventually.
Comparison
| Aspect | ACID | BASE |
|---|---|---|
| Priority | Consistency and correctness | Availability first |
| Consistency | Strong, checked at every transaction | Weak. Stale data is OK |
| Approach | Pessimistic and strict | Optimistic ("aggressive"), best effort, approximate answers OK |
| Complexity and speed | More overhead | Simpler and faster |
Use Cases
-
ACID
- where correctness is highly critical
- banking, payments, inventory
-
BASE
- where availability matters than getting the most updated info
- social media, caches, product catalogs