ACID vs BASE
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    ACID vs BASE: the 60-second story

    ACID vs BASE

    The teller makes you queue. The drop box hands you a receipt.

    The teller is ACID: both records change or neither. The drop box is BASE: no queue, eventually correct, more machinery.

    Same invariant. Who guards it: the database or your code?

    ACID: one transaction, all-or-nothing and isolated. BASE: small local commits, events in between, and retries, compensations and reconciliation to repair the gaps.

    A PostgreSQL primary with async read replicas. ACID or BASE?

    Two axes

    Both. Transactions keep invariants true (ACID’s C); replicas converge later (BASE’s E). Different promises, independent axes.

    +43 min

    extra downtime a month for a two-database commit

    Two-phase commit needs both up: 99.9% × 99.9% ≈ 99.8%. Chain five and it’s about 3.6 hours. Pritchett’s eBay answer: split data by function, shard each.

    The same sale, BASE-style: commit locally, publish, apply once

    Sale and outbox row commit together. A relay publishes at least once; the consumer adds 640 only for a new sale ID.

    So is BASE just NoSQL?

    Bad: SQL is ACID, NoSQL is BASE

    DynamoDB and MongoDB have transactions; PostgreSQL shops run sagas.

    Good: Label the operation

    Ask which invariant must hold, and how stale each read may be.

    Order biryani: what must be atomic, what can lag?

    Order state, payment and ledger lines commit together. Restaurant, rider and push follow as outbox events, retried and de-duplicated.

    You paid. The restaurant never accepts. Now what?

    1. C1, one local commit: cancel, reverse, request refund
    2. C2: refund with its own idempotency key, retried with backoff
    3. Until it settles, the app shows “refund initiated”

    Remember

    ACID and BASE are about who guards invariants. Choose per feature: a small ACID core for money and scarce stock; BASE edges, retried and idempotent, for the rest.