Make the invariant atomic
A check followed by a separate write is vulnerable to concurrent requests. For a limited resource, the availability check and allocation must share an atomic transaction or supported conditional update. Adding a second read does not turn a non-atomic sequence into a lock.
Separate intent, execution, and reconciliation
Persist an approved intent before executing an external effect. Track delivery and acknowledgement, and reconcile uncertain outcomes. Transactional outbox patterns help coordinate database changes with message delivery, but recipients still need duplicate handling.
Budget for overload and degradation
Define timeouts, concurrency limits, retry budgets, and a safe degraded mode. Unlimited retries can amplify an outage. Monitor business outcomes such as duplicate orders and stuck approvals as well as latency and error rates. Test recovery from failures between individual steps.
A worked example
Use an atomic reservation at the source of truth. Only the winner can create the approved booking. Make subsequent confirmation retryable, and reconcile a lost response using the reservation ID.
The point: Correctness comes from the protected state transition, not from how quickly the checks run.
Before you take the exam
Explain these concepts in your own words, work through a different example, and describe why the tempting alternatives fail. Use the references to go deeper.