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.

    Layer 3 · Go deeper · 6 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    How much downtime does one commit across two databases add?

      How often does the refund path actually run?

        Build-up · 6 steps

        Record one sale, ACID then BASE

        Pritchett’s marketplace example, food-delivery style. Record a sale and add it to the restaurant’s running earnings total, first in one transaction, then in local steps.

        Step 1 of 6

        ACID: one transaction

        One transaction inserts the sale and adds 640 to the restaurant’s total. Simple and correct, but it pins both tables to one server forever, and a busy restaurant’s sales queue on one row lock.

        3 interview moments

        You’re the candidate

        The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

        1. Deep dive 1 of 3

          Interviewer

          “Sales and restaurant earnings now live in separate services. Each delivered order must add to the restaurant’s total. How do you write both?”

          Your move. Pick an approach:

        2. Deep dive 2 of 3

          Interviewer

          “Two services, each with its own database up 99.9% of the time, must change together. Do you use two-phase commit?”

          Your move. Pick an approach:

        3. Deep dive 3 of 3

          Interviewer

          “A flash sale has 100 units, and orders flow through events. How do you make sure the 101st buyer isn’t confirmed?”

          Your move. Pick an approach: