Optimistic Concurrency Control
also called OCC, Compare-and-Set
Allowing concurrent work without locks and detecting conflict at write time by checking that the underlying version has not changed.
Read the record with its version, do the work, then write conditionally: update only if the version is still what I read. If it changed, someone else wrote first, and this transaction retries or surfaces the conflict.
The trade against locking is straightforward. Optimistic control has no coordination cost when conflicts are rare, no deadlocks, and no lock to expire or leak — which makes it dramatically simpler operationally. Under high contention it degrades, because work is done and then discarded, and a hot record can starve as retries repeatedly lose.
It is available almost everywhere without extra infrastructure: HTTP If-Match with ETags,
conditional writes in DynamoDB and object stores, UPDATE ... WHERE version = ? in any relational
database, and @Version in most ORMs.
The design guidance: prefer optimistic control for records with low contention, and reach for pessimistic locking only where contention is high and the work before the write is expensive. And note it composes well with idempotency — a retry with the same idempotency key and a version check is a strong pair.