At a glance
How far behind the slowest follower replica is in applying the Raft log, measured in seconds. CockroachDB replicates every range across multiple nodes using the Raft consensus protocol; a write is committed once a quorum acknowledges it, but follower replicas still need to catch up to the leader. This card reports the worst replication lag observed across the cluster. A healthy cluster keeps quiescent ranges (idle ranges drop out of Raft heartbeating to save CPU) and shows near-zero lag on active ranges. Sustained lag means a follower is falling behind: a sign of a slow disk, a saturated network link, an overloaded node, or a snapshot in flight. For an SRE this is the early-warning gauge for a node that is about to become unhealthy or under-replicated.
Calculation
CockroachDB tracks, per range, how far each follower replica has progressed through the committed Raft log relative to the leaseholder. When a follower’s applied index trails the committed index, that range has replication lag; Vortex IQ converts the worst follower’s position into an elapsed-seconds estimate using the command apply timing. The displayed number is derived as follows:- Read the replication and Raft metrics from each live node’s status endpoint: the per-range follower-behind signals and
raft.process.applycommitted.latency. - Exclude quiescent ranges. Idle ranges deliberately stop Raft heartbeating to save CPU and have no meaningful lag; counting them would create false signal.
- Take the cluster-wide maximum lag across all active ranges and their followers. This is a worst-case gauge by design: one badly-lagging follower is the thing you need to know about, and averaging would hide it.
- Normalise to seconds and compare against the
> 10salert threshold. A sustained breach flips the card to alert and feeds the alert-rules layer.
Worked example
A platform team runs a 5-node CockroachDB cluster (v23.2) with the default replication factor of 3. Baseline quiescent lag sits at well under 1 second. Snapshot taken on 03 Jun 26 at 21:18 BST, shortly after a node was restarted for an OS patch.
The cluster-wide headline reads 14.6s, above the 10s threshold, so the card is alerting. The lag is isolated to n4, the node that was just restarted. Its disk write p99 is 40x the others, which is the tell: n4 came back, is replaying and catching up on the ranges it missed during the restart, and its disk is the bottleneck for that catch-up.
This is the benign-but-watch case. A node that has just rejoined is expected to lag briefly while it reapplies missed entries and receives Raft snapshots for any ranges that moved on without it. The questions are: is it trending down, and is the cluster under-replicated while it catches up?
- Lag right after a node rejoins is normal; lag that does not fall is not. The shape over time is everything. A steadily declining figure after a restart or rebalance is the cluster healing. A flat, sustained figure is a node that cannot keep up and needs investigation.
- Always pair lag with the under-replication view. A lagging follower is only a safety problem if it means a range is short of up-to-date replicas. Under-Replicated Ranges tells you whether the lag has crossed into real risk.
- The cause is almost always node-local resources. Disk write latency, CPU saturation, or a constrained network link on the lagging node. Find the node first (the per-node view localises it), then check that node’s disk and CPU before suspecting CockroachDB itself.
Sibling cards
Reconciling against the source
Where to look in CockroachDB’s own tooling:DB Console → Metrics → Replication dashboard carries the “Replicas per Store”, “Snapshots”, and follower-behind charts. The “Replica Quiescence” panel shows the quiescent vs active split. DB Console → Advanced Debug → Problem Ranges lists ranges with replication issues, including raft-log-behind followers.Why our number may legitimately differ from the DB Console:SELECT * FROM crdb_internal.kv_store_statusandcrdb_internal.rangesexpose per-range and per-store replication state from SQL.cockroach node status --rangesfrom the CLI shows per-node range and leaseholder counts, useful for localising a lagging node. For CockroachDB Cloud (Dedicated), the same Replication dashboard is available under Monitoring in the Cloud Console; the metrics export feeds the identical replication metric names to Prometheus/Datadog.
Cross-connector reconciliation: