At a glance
How many seconds behind the primary each replica is. Redis replication is asynchronous, so a replica always trails the primary by some amount; the question is how much. A few hundred milliseconds is normal. Ten seconds or more means the replica has fallen so far behind that promoting it during a failover would lose the last ten seconds of writes, and any reads served from it are stale by that much. For a platform team this is “if my primary dies right now, how much data do I lose, and how stale is everything my read-replicas are serving?”
Calculation
The card connects to each replica (not the primary) and readsmaster_last_io_seconds_ago from INFO replication. This field is the number of seconds since the replica last received any data, ping or command, from the primary. Under healthy streaming replication the primary sends a PING to replicas every repl-ping-replica-period seconds (default 10), so a healthy replica’s master_last_io_seconds_ago oscillates between 0 and that ping interval and the card reports a low number.
master_last_io_seconds_agois a connectivity proxy, not a byte-offset. It tells you the replica heard from the primary recently; it does not directly measure how many bytes behind it is. For exact byte lag you comparemaster_repl_offseton the primary against the replica’s offset. The card usesmaster_last_io_seconds_agobecause it is the field exposed on the replica and rises sharply the instant the replication link stalls, which is the failure mode that matters most.master_link_statusgates the reading. Ifmaster_link_status:downthe replica is not connected at all; the card surfaces that as a broken link rather than a lag number, because “lag” is meaningless when the stream is severed.- A value of -1 or a very large number indicates the replica has never synced or has lost the link entirely. The engine treats these as the maximum-severity case, not as “0 seconds behind”.
- Per-replica reporting. A primary with three replicas yields three readings; one slow replica (often a cross-region one) can be lagged while the others are healthy. The headline is the worst replica, but all are available for drill-down.
Worked example
A platform team runs a primary in eu-west-1 with two replicas: one in-region for read scaling and failover, one in us-east-1 for a read-only reporting workload. Redis 7.2, self-hosted on EC2. Snapshot taken on 02 May 26 at 13:40 BST during a heavy write batch (a nightly catalogue reindex pushing several hundred thousand writes).
The headline shows 23s in red (the worst replica), tripping the
> 10s alert. The engineer reads it:
- replica-a is healthy at 0 seconds. In-region, low network latency, keeping pace with the write batch.
- replica-b is 23 seconds behind. The link is up, so this is not a disconnect, it is genuine lag. The cross-region link (eu-west-1 to us-east-1, around 70 to 90 ms RTT) cannot keep up with the burst of writes from the reindex, so the replication buffer is draining slower than it fills.
- What is the impact? The reporting workload reading from replica-b is serving data 23 seconds stale. For a reporting dashboard that is usually fine. But if replica-b were a failover candidate, promoting it now would lose 23 seconds of writes, which for an order or session store is unacceptable.
- Lag is the data-loss budget for a failover. N seconds of lag means promoting that replica loses up to N seconds of writes. For order and session stores, set
replica-priorityso the lowest-lag replica is always promoted first. - Cross-region replicas lag during write bursts, and that is physics. An 80 ms link cannot stream a burst as fast as an in-region one. Size
repl-backlog-sizeso a transient burst does not trigger a full resync, and do not put failover-critical or session reads on a cross-region replica. - Link up plus high lag is different from link down. Up plus lag means the stream is flowing but slowly (network or write-rate bound). Down means the replica must resync from scratch (a partial or full sync), which is a far more severe event. Pair with Connected Replicas to see if the link dropped entirely.
Sibling cards
Reconciling against the source
Where to look in Redis’s own tooling:For managed services:redis-cli INFO replicationrun on the replica showsrole:slave,master_link_status,master_last_io_seconds_ago, andslave_repl_offset. Themaster_last_io_seconds_agoline is exactly what the card reads.redis-cli INFO replicationrun on the primary lists each replica withslaveN:ip=...,offset=...,lag=.... Compare the primary’smaster_repl_offsetagainst each replica’s reported offset for the exact byte lag. The offset difference in bytes (master_repl_offseton primary minus the replica’s offset) is the precise lag;master_last_io_seconds_agois the time-based proxy the card surfaces.
ElastiCache / MemoryDB: the CloudWatch metric ReplicationLag (in seconds) is the direct equivalent and the canonical figure for AWS-managed clusters. Compare it node by node against the card.
Azure Cache for Redis: geo-replication lag is reported in Azure Monitor for the geo-replica link.
Redis Cloud (Redis Enterprise): the Active-Active / replica-of lag is reported in the database metrics view.
Why our number may legitimately differ:
Known limitations / FAQs
My primary is idle and the replica shows 8 to 10 seconds of “lag”. Is that bad? No, that is the ping interval, not real lag. On a quiet primary,master_last_io_seconds_ago rises until the next periodic PING (every repl-ping-replica-period seconds, default 10) resets it to 0. The engine accounts for this so a low-traffic replica is not falsely alerted. Real lag shows as a sustained high value under active writes, not a sawtooth on an idle instance.
Is master_last_io_seconds_ago the same as how many writes I would lose on failover?
Not exactly, but it is the right alarm. The precise data-loss figure is the byte offset difference (master_repl_offset on the primary minus the replica’s offset). master_last_io_seconds_ago is the time-based proxy that spikes the instant the link stalls, which is the failure you most need to catch. Use the offset diff for the exact recovery-point figure.
The link status says down. Why does the card not just show a huge lag number?
Because lag is meaningless when the stream is severed. A down link means the replica must resync (partial if the backlog covers the gap, full if not), which is a categorically more severe event than slow streaming. The card surfaces a broken link distinctly rather than as “infinity seconds behind”.
How do I control which replica gets promoted on failover?
Set replica-priority (lower number equals higher priority; 0 means never promote). Configure your lowest-lag, in-region replica with the highest priority so a failover always promotes the replica with the smallest data-loss budget. Sentinel and Cluster both honour this.
My cross-region replica is chronically 20+ seconds behind. How do I fix it?
Cross-region lag during write bursts is largely network physics. Mitigations: raise repl-backlog-size so a transient burst does not force a full resync; do not put failover-critical or user-facing reads on the cross-region replica (use it only for reporting where staleness is acceptable); or add an in-region replica for failover and keep the cross-region one for analytics.
Does diskless replication change these numbers?
Diskless replication (repl-diskless-sync yes) changes how the initial full sync is transferred (streamed over the socket rather than via an RDB file on disk), which affects resync time. Steady-state streaming lag, what this card measures, is unaffected; master_last_io_seconds_ago behaves the same once the replica is in sync.