liveBook · Manning

ACID

As explained in Grokking Software Architecture

A database transaction that provides atomicity, consistency, isolation, and durability guarantees.

Two shoppers reach for the last pair of sneakers. An order needs to be recorded and inventory updated without leaving the database in a half-finished state. ACID names four transaction guarantees that help protect data integrity: atomicity, consistency, isolation, and durability. section 8.2.1

Each guarantee tackles a different failure risk:

  • Atomicity — all or nothing. Deducting inventory and creating the order form one transaction. If it fails halfway through, the changes roll back. section 8.2.1
  • Consistency — follow the rules. A transaction moves the database from one valid state to another; a constraint against negative inventory can reject an overselling attempt. section 8.2.1
  • Isolation — don't expose the half-finished work. In the purchase example, another reader sees inventory before or after the transaction, not its intermediate calculation. section 8.2.1
  • Durability — keep the committed result. Once the order transaction commits, its result remains recorded even if the database server fails afterward. section 8.2.1

ACID is not exclusive to relational databases: MongoDB and DynamoDB also offer multi-document ACID transactions. When services do not share an ACID transaction, consistency needs a different approach. A saga sequences local transactions with compensating fallbacks; a transactional outbox helps guarantee network events are published. section 8.2.5 section 12.11

How Grokking Software Architecture covers it

How deep it goes
Defines all four guarantees through a transaction scenario, without detailing their implementation.
Examples
Illustrates a last-sneaker purchase with inventory updates, order creation, rollback, and an overselling constraint.
What you can do after
Evaluate how transaction guarantees protect a purchase and why distributed services need other consistency patterns.
How it connects
Connects transactions to database constraints, relational databases, NoSQL, sagas, and the transactional outbox pattern.

Also explained in

Compare how 10 books explain ACID →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.