Skip to content
ENExplore Calculators

Lock Contention Estimate Calculator

Work out lock contention estimate instantly with clear inputs, formula shown and shareable results.

About Lock Contention Estimate Calculator

A row lock held for h milliseconds caps that row at 1000/h updates per second no matter how much hardware you add. Treating the lock as a single server queue, wait time grows as rho/(1-rho), so contention is invisible until utilisation nears one and then becomes catastrophic. Concentrating updates on a counter row is the classic way to hit this wall.

Formula

Lock contention

per-row rate = contended TPS / hot rows; utilisation = per-row rate x hold time; wait = utilisation x hold / (1 - utilisation); ceiling = 1000 / hold time in ms

Worked example

With the default values below, Lock Contention Estimate Calculator returns Expected lock wait of 0.083. Change any input above and every figure here is recalculated in your browser.

Inputs used

Transactions per secondminimum 0.001
1,200
Lock hold timeminimum 0.001 ms
3 ms
Share of transactions touching the hot rowaccepts 0.01–100 %
15 %
Number of hot rowsminimum 1
20

Results

Expected lock wait
0.083 ms
Lock utilisation per hot row
0.0270
Transactions competing for hot rows
180
Ceiling on updates per hot row per second
333 tps

Step by step

  1. 1Values used
  2. 2Lock contention
  3. 3Expected lock wait= 0.083 ms
  4. 4Lock utilisation per hot row= 0.0270
  5. 5Transactions competing for hot rows= 180
  6. 6Ceiling on updates per hot row per second= 333 tps

Assumptions and limits

  • The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 4 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

How is a hot-row bottleneck removed?

Shard the counter across many rows and sum on read, move the aggregation to an asynchronous job, or use an atomic increment that holds the lock for microseconds instead of milliseconds.

Why does contention appear suddenly?

Because wait time is non-linear in utilisation. Traffic growth of ten percent can take a lock from 85 to 95 percent utilisation, tripling the wait.

Lock Contention Estimate Calculator | Calcrivo