System Design Atlas

B2B wholesale orders with credit limits

08 / 10Worked example

Investigating bottlenecks

Which measurement distinguishes customer and item hotspots?

The failure sequence shows where load and retries interact. The diagnostic plan treats measured waiting time, processing duration and business conflicts separately.

Starting point Convert the reservation into a receivable exactly once.

Assumptions for the example case

A fictional example design with one customer, one currency and one warehouse; a binding price offer; complete local stock and credit reservations; and one complete delivery. Figures and quality goals are illustrative test assumptions. Multiple currencies, tax calculation, partial delivery and credit insurance are outside the scope.

Diagnose the limiting resource

Distinguish backlog from business contention

30 orders/s600 seconds
Outbox ageMeasure processing duration
Two commitments15 boxes · 30,000 cents
Conflict rateExactly one winner

Queue age explains load; capacity_conflict indicates correct rejection when stock or credit is insufficient.

An item or large customer causes waits. Measure lock duration separately by item and customer. Targeted optimisation preserves the joint commitment.

From signal to action

SignalValidationReaction
Distinguish item and customer bottlenecksAn item or large customer causes waits.Measure lock duration separately by item and customer.
Conflicts on the shared entityTwo orders each request 10 boxes and 20,000 cents against 15 boxes and 30,000 cents available. In either commit order, one wins; 5 boxes and 10,000 cents remain. No order may reserve only stock or only credit.Count expected conflicts separately from technical errors.
Peak test profile exceeded30 orders/s for 600 s = 18,000 ordersA single customer dominates permanently.

Distinguish item and customer bottlenecks

Validation
An item or large customer causes waits.
Reaction
Measure lock duration separately by item and customer.

Conflicts on the shared entity

Validation
Two orders each request 10 boxes and 20,000 cents against 15 boxes and 30,000 cents available. In either commit order, one wins; 5 boxes and 10,000 cents remain. No order may reserve only stock or only credit.
Reaction
Count expected conflicts separately from technical errors.

Peak test profile exceeded

Validation
30 orders/s for 600 s = 18,000 orders
Reaction
A single customer dominates permanently.

Distinguish item and customer bottlenecks

Distinguish item and customer bottlenecks

Measure lock duration separately by item and customer.

An item or large customer causes waits.

Targeted optimisation preserves the joint commitment.

Alternative considered
Global throughput measurement does not show the hotspot.
Trade-off
Metrics need limited aggregation.
Reassess
A single customer dominates permanently.

Terms in this step

Distinguish item and customer bottlenecks
Targeted optimisation preserves the joint commitment.

Try it yourself

Only orders from one large customer are waiting. Name a metric and a case-specific investigation.

A hint for your attempt

Use the specific entities and conditions from this step. The two solution parts distinguish the decision from its evidenced outcome.

Compare with a possible solution
First part of the solution
Separate lock waiting time by customer from lock waiting time by item.
Second part of the solution
Inspect access to that customer’s credit reservations. More general API capacity does not eliminate the same serialised credit-limit check.

Apply to your project

Which corresponding assumption would you test first in your project? Consider this trigger: A single customer dominates permanently.

Step 9 examines uncertain fulfilment.