Aerospike Vector opens new approaches to AI-driven recommendationsWebinar registration
Blog

ACID Compliance

Aerospike square logo
Aerospike Marketing
August 26, 2022|4 min read

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

    Atomicity ensures that each transaction either succeeds completely or fails completely. In other words, each transaction is treated as a single unit. This guarantees that the database isn’t left in an intermediate state. For example, even in the case of a power failure, the entire transaction will either commit or roll back to maintain data integrity. This is especially important for multi-document ACID transactions, which may involve multiple database tables and operations. Atomic transactions also prevent partial changes from affecting multiple transactions that depend on accurate data.

  • Consistency

    Consistency, or correctness, makes sure that a transaction can only bring the database from one valid state to another. In an ACID model, this principle ensures that no invalid data is written to the database. 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 and ensures data consistency across the system.

  • Isolation

    Isolation makes sure that concurrent transactions leave the database the same as they would have been if the transactions were processed 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 with or affecting one another. Different isolation levels can be implemented to control how transactions are processed concurrently. Techniques like repeatable read, serializable isolation, and snapshot isolation offer varying degrees of control over data visibility to maintain data integrity during concurrent access.

  • Durability

    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. By writing data to persistent storage across multiple physical servers, Aerospike enhances durability for critical data management scenarios.

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. In large distributed systems, maintaining ACID transactions ensures that even complex processes involving multiple transactions adhere to these principles. 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 (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?

The 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. Aerospike, for example, offers ACID transactions for single-key operations while providing scalability in a distributed environment. 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.

Try now