jargon

Comparison

DeadlockvsLock contention

Deadlock

two transactions each hold a lock the other one needs and both sit there until the database kills one of them.

A cycle of processes each waiting on a resource held by another, so none can proceed. Databases detect and abort a victim; in application code it usually just hangs. The standard prevention is a global lock ordering: always acquire in the same sequence, and the cycle cannot form.

Full entry →

Lock contention

you added more workers and throughput did not improve, because they are all queued behind the same lock.

Time lost waiting for a lock rather than doing work. It is what makes a system stop scaling with cores or instances, and it is often invisible in per-request timing until you look at wait events. Reducing the critical section, sharding the lock, or moving to lock-free structures are the levers, in that order of effort.

Full entry →

Related comparisons