Database Replication Lag Calculator
Estimate replication lag from write volume and apply throughput.
About Database Replication Lag Calculator
Replication lag is a queueing problem: if writes arrive faster than the replica applies them, lag grows without bound rather than settling. Single-threaded apply is the usual constraint. Reading from a lagging replica returns stale data, which is why utilisation above 80 per cent is a correctness concern rather than just a performance one.
Formula
Database Replication Lag
Lag grows whenever the write generation rate exceeds the replica apply rate
- apply rate
- How fast the replica can replay changes, often single-threaded
- backlog
- Changes generated but not yet applied
Worked example
With the default values below, Database Replication Lag Calculator returns Estimated Replication Lag of 33.358. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Writes per second on the primaryminimum 0
- 1,200
- Bytes per writeminimum 0 bytes
- 400 bytes
- Replica apply throughputminimum 0.001 MB/s
- 1.2 MB/s
- Network latency to the replicaminimum 0 ms
- 25 ms
- Existing backlogminimum 0 MB
- 40 MB
Results
- Estimated Replication Lag
- 33.358 s
- Write Generation Rate
- 0.4578 MB/s
- Time to Drain the Backlog
- 53.891 s
- Apply Capacity Utilisation
- 38.15%
- Verdict
- Replica has capacity to stay current
Step by step
- 1Values used
- 2Database Replication Lag
- 3Estimated Replication Lag= 33.358 s
- 4Write Generation Rate= 0.4578 MB/s
- 5Time to Drain the Backlog= 53.891 s
- 6Apply Capacity Utilisation= 38.15
- 7Verdict= Replica has capacity to stay current
Assumptions and limits
- The result is derived only from the 5 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 Database Replication Lag calculated?
Lag grows whenever the write generation rate exceeds the replica apply rate Replication lag is a queueing problem: if writes arrive faster than the replica applies them, lag grows without bound rather than settling. Single-threaded apply is the usual constraint.
Why does Database Replication Lag matter?
Reading from a lagging replica returns stale data, which is why utilisation above 80 per cent is a correctness concern rather than just a performance one.
What values do I need to enter?
This calculator takes 5 inputs: Writes per second on the primary, Bytes per write, Replica apply throughput, Network latency to the replica, Existing backlog. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.
