System Design Atlas

Service marketplace

07 / 10Worked example

Critical flow

Where is the second award prevented?

Three sequences test the normal flow, version conflict and lost response.

Starting point Find the version check immediately before commit.

Assumptions for the example case

Illustrative design: 10,000 searches and 1,000 new requests per day, averaging five offers per request; a peak of 25 searches/s; and 20 concurrent award attempts against the same request. Payment, service delivery and warranty are outside the scope.

Participant sequences

Tabs separate the critical variants.

Expected outcomes

Normal flow
O-17 wins and L-17 is created.
Concurrency
The second commit gets version_conflict.
Replay
K-17 delivers the same L-17.

Terms in this step

Linearisation
A competing commit is ordered before or after the other commit.

Try it yourself

Run two commands against version 4.

A hint for your attempt

The first increments the version to 5.

Compare with a possible solution
Winner
Committed A-17/v5 and L-17.
Loser
version_conflict and current state.

Apply to your project

Use the pattern for a one-time allocation.

Measurements lead from symptom to cause.