AlgoViz

ACID: atomicity and durability

medium 26 min

A transaction turns several changes into one: all of them happen or none do, and once committed they survive a crash.

Where it shows up

The same pattern appears across everyday software.

  • Banking

    A transfer of $100: the debit and the credit must both happen.

  • Shopping

    Order, stock and an outbox row for the payment commit together. The payment itself follows with an idempotency key.

  • Reservations

    A seat and its ticket are written together, and a unique constraint stops a second booking of the seat.

  • SQLite's rollback journal

    SQLite's documentation describes how it first writes the original content of the pages to a journal file, so that an interrupted change can be put back.

  • DynamoDB transactions

    The developer guide says TransactWriteItems groups up to 100 write actions into one all-or-nothing operation, with at most 4 MB in total.

  • MongoDB transactions

    The manual says a transaction must by default run for less than one minute, a limit that can be changed. It is a reminder to keep them short.