ACID vs BASE Database Transaction Models
ACID
ACID stands for Atomicity, Consistent, Isolated, and Durability.
- Atomicity: all transactions are guaranteed to succeed, otherwise they are all reverted
- Consistent: a transaction cannot leave the database in an inconsistent state
- Isolated: transactions keep their integrity, even if they are running “in parallel”
- Durability: once a transaction is successfully written, it persists through hardware and network faults
Examples
Relational database systems are usually ACID. MySQL, PostgreSQL, SQLite, SQL Server, etc.
BASE
BASE stands for Basically Available, Soft State, and Eventual Consistency.
- Basically Available: appears to work most of the time
- Soft State: data stores may not be write-consistent, and replicas may not be synced with one another
- Eventual Consistency: writes will respond with SUCCESS before the data is actually persisted
Examples
NoSQL databases tend to be BASE. MongoDB, Cassandra, Redis, Amazon DynamoDB, Couchbase, etc.
Choosing which one
No hard answer.
This really depends on the application use case.
A thorough consideration must be executed given the details of the application system.
Does your application need consistency, reliability, predictability? Then maybe ACID is better.
Does your application need high availability? If you are looking to scale up to huge volumes of data, BASE transaction models might be better.
There is no easy answer. Make sure to do your work on gathering the requirements of your project.
If you choose the wrong model for your system, you can end up paying a hefty price for it.
That’s all.
Hope you learned something!