Outbox
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.

    Build-up · 5 steps

    Follow one order through the outbox

    A food order from tap to kitchen. Steps 1 and 2 are the request; everything after the commit happens in the background.

    Step 1 of 5

    One local transaction

    The order service inserts the orders row and an OrderPlaced row into the outbox table in one transaction. Both commit, or neither does.

    4 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 4

      Interviewer

      “Your order service needs a relay. Volume is moderate and there’s no CDC platform yet. What do you build?”

      Your move. Pick an approach:

    2. Deep dive 2 of 4

      Interviewer

      “Payments consumes OrderPlaced and captures money. The relay is at least once. How do you make sure nobody is charged twice?”

      Your move. Pick an approach:

    3. Deep dive 3 of 4

      Interviewer

      “Outbox volume is outgrowing one relay. How do you scale it without reordering a payment’s PENDING and SUCCESS?”

      Your move. Pick an approach:

    4. Deep dive 4 of 4

      Interviewer

      “At 6,000 events a second, the outbox grows by hundreds of millions of rows a day. How do you clean it up?”

      Your move. Pick an approach:

    Build-up · 4 steps

    How two relays reorder one payment

    Payment pay-42 goes PENDING, then SUCCESS. Two relay replicas poll the outbox at the same moment.

    Step 1 of 4

    One payment, two events

    The outbox holds pay-42’s events as rows 41 and 42, in commit order, because both transactions updated the same payment row.