Backend systems · concurrency

Concurrency
Control Lab

Three requests read the same record, then write in sequence. Watch a last-write-wins policy lose updates—and see optimistic locking reject stale writes before retrying them safely.

Shape the race

Each request computes its change from version 0. Change order to see which stale write wins.

Run result

Final balance
—

Commit trace

CommitConflict / overwriteRecomputed retry

Why versions matter

A version check turns silent data loss into an explicit conflict. Retrying is safe only when the operation can be recomputed against fresh state; production APIs also need transaction boundaries, idempotency, bounded retries, and a clear conflict response.