Interactive Systems Explainers

Lock Contention Playground

See one shared resource block concurrent work.

i
Lock contention experiment controls

Key Observations

What to Notice

Example: inventory updates

Imagine many customers buying the same product. One update owns the inventory row while every other worker waits behind it.

Hot Resources

Some rows receive most of the traffic. The hot row glows while nearby rows sit mostly free.

Blocked Work

A locked row only has one owner. Extra workers stop helping once they are all waiting for the same lock.

Convoy Effects

One slow update holds the lock longer, so the waiting chain behind it grows even when each normal update is small.

Real-World Context

Lock contention is a practical limit on parallelism. It tends to gather around shared database rows, inventory records, counters, account balances, ledger entries, scheduler state, and coordination tables.

Adding workers does not help when all of them need the same exclusive resource; it can increase blocked transactions and deadlock risk. Sharding hot records, batching updates, optimistic concurrency, and moving coordination out of the critical path all trade simplicity for reduced contention. Hot spots often surface only after traffic concentrates on a popular entity.

Interactive Systems Explainers

Explore Next