What is ACID compliance and why is it important? Learn how Aerospike offers the highest quality database solutions.
What is ACID compliance?
ACID compliance stands for atomicity, consistency, isolation and durability. This is a set of principles that ensures database transactions are processed reliably. When a database maintains these principles, it is known as being ACID compliant.
What are the elements of ACID compliance?
Atomicity ensures that each transaction either succeeds completely or fails completely. In other words, each transaction is treated as a single unit. This means that if any statement making up a transaction does not complete, then the entire transaction fails and the database isn’t changed. An atomic system must promise atomicity in every single situation, including things like power failure, errors and crashes. This guarantee stops updates to the database from only partially taking place, which can cause bigger problems than rejecting the entire series. As a result, the transaction can’t be seen to be in progress by another database client.
Consistency, or correctness, makes sure that a transaction can only bring the database from one valid state to another. Data is considered in a consistent state when a transaction begins and when it ends and no steps are missed. Any data written to a database must be valid as stated by defined rules, including constraints, cascades, triggers and any combinations of these. This prevents illegal transactions from corrupting the database.
Isolation makes sure that a concurrent transaction execution leaves the database the same as it would have been were the transaction done sequentially. This is important when more than one user is reading and writing from the same table at the same time. Isolation prevents concurrent transactions from interfering or affecting another one. Even though the transactions are happening simultaneously, they seem as though they’re happening one at a time.
Durability ensures that once a transaction takes place, it can be completely recovered even if the system fails due to a power outage or some other problem. For example, this can be important in cases such as financial transactions when a failed system that recovers will still show that a payment has been made or money transferred.
Why is ACID compliance important?
ACID compliance is important because an ACID compliant database does not lose data. This is critical for databases that require strong consistency, such as when concurrent users need to read or make changes to data at the same time. Without ACID compliance, there could be data loss or incorrect results. The four principles of ACID compliance ensure that there is reliability, correctness, isolation and durability so that databases must always succeed or fail in reliable and expected ways. Being ACID compliant can alleviate operational headaches and concerns.
Is NoSQL ACID compliant?
NoSQL can be ACID compliant, however NoSQL databases were created to go outside the parameters of ACID compliance to provide more data flexibility. For those needing strict environments, SQL is often the route of choice. Most, but not all, NoSQL databases follow BASE, which stands for basically available, soft state, eventual consistency principles. That means that instead of enforcing immediate consistency, this model promises data availability by spreading and replicating it across the nodes of a database cluster. With BASE, developers are responsible for consistency and data reads are still possible even if there is data not fully consistent.
Can NoSQL systems be ACID compliant?
To short answer is, “yes”, at least to the extent of enforcing transactions. Some NoSQL systems have not only an eventually consistent mode but also a strong consistency mode. One way this is achieved is via strong consistency for single key transactions along with replication in a distributed cluster environment (Linearizability, Sequential or Session Consistency.) Consistency can be maintained on a primary key basis and durability by committing the writes to multiple physical servers with independent hardware components. For even greater durability, a write may be required to flush to persistent storage.
ACID compliance can be important to meet some business objectives, while others may not prioritize ACID. Find out how Aerospike’s multi-model, NoSQL database solutions can help you meet your business goals.