Lock contention
Definition
Lock contention occurs when several workers need exclusive access to the same shared resource at the same time, and all but one must wait until the lock is released.
In practice
A critical section held for a fraction of each request becomes the serial part in Amdahl's law: if every request holds a lock for 1 ms, that lock caps throughput at 1,000 requests per second however many threads or cores exist. The same effect appears in databases as row locks on a hot counter and in caches as one hot key.
Contention is easy to miss because CPU looks low while latency climbs. Remedies are holding locks for less time, splitting one lock into many (striping, per-key locks), using atomic operations or append-only designs, and batching updates. Adding threads usually makes it worse, because more waiters mean more coordination overhead.
Example
A stock_count row updated by every order caps checkout at about 500 orders per second; splitting it into 16 counter rows that are summed on read raises the ceiling roughly 16×.