At a glance
The total size, in megabytes, of binary-log data that the primary has written but the slowest replica has not yet consumed. It measures replication backlog by volume rather than by time: how much data is queued waiting to ship to and be applied by replicas. A small, stable backlog is healthy. A backlog that keeps growing means a replica is falling behind faster than it can catch up, and beyond a point the primary risks purging binlogs the replica still needs, which breaks replication outright.
Calculation
The engine takes two readings each sample. From the primary,SHOW BINARY LOGS returns every binlog file and its size, and SHOW MASTER STATUS (or SHOW BINARY LOG STATUS on 8.4+) gives the current write file and position. From each replica’s SHOW REPLICA STATUS it reads Source_Log_File and Read_Source_Log_Pos (the IO thread’s fetch position). The backlog against a given replica is:
Worked example
A platform team runs a primary on MySQL 8.0 with two replicas, one of which (Replica B) is under-provisioned and applies single-threaded. A bulk catalogue re-import kicks off at 22:00 on 11 Jun 26, writing heavily for an hour. Snapshot series:
The Alert Rules card crosses its
> 1GB threshold around 22:35 and reads 1,610 MB backlog on Replica B by 22:50, amber and climbing. Replica A (multi-threaded, well-provisioned) stays under 50 MB throughout, so the card reports B’s figure because B is the worst case.
The DBA’s read:
- The backlog is growing, not just large. A steady 1,610 MB would be a tolerated batch artefact. A backlog rising ~430 MB every 15 minutes means B is consuming binlog slower than the primary produces it: it is losing ground and will keep losing ground until the write burst ends or B speeds up.
- The real danger is binlog retention. If
binlog_expire_logs_secondsis set low, the primary may purge a binlog file before B has read it. The instant that happens, B’s IO thread errors with 1236 (“could not find first log file”) and replication breaks, requiring a full re-clone. Backlog growth is the early warning for this. - Two levers, short and long. Short term: ensure the primary retains binlogs long enough to cover the catch-up (raise
binlog_expire_logs_seconds, and do not let disk pressure force an early purge). Long term: enable multi-threaded apply on B (replica_parallel_workers) or right-size the instance so a write burst like this drains in minutes, not hours.
- Volume and time are different lenses on the same lag. Time (
Seconds_Behind_Source) tells you how stale the replica’s data is; volume (backlog MB) tells you how much work is queued and, crucially, how close you are to a purge-induced break. Watch both. - The slope is the signal. A large but flat backlog during a known batch is tolerable. A backlog with a positive slope is a replica losing the race, and it will not fix itself until the write rate drops or apply speed rises.
- Backlog is the leading indicator of a 1236 break. The most damaging replication failure (binlog purged before the replica read it) is preceded by exactly this growth. Acting on the amber here prevents a re-clone later.
Sibling cards
Reconciling against the source
Where to look in MySQL itself:On the primary:To compute the byte gap by hand, sum the sizes of the binlog files between the replica’sSHOW BINARY LOGS;for every binlog file and its size, andSHOW MASTER STATUS;(orSHOW BINARY LOG STATUS;on 8.4+) for the current write file and position. On each replica:SHOW REPLICA STATUS\GforSource_Log_FileandRead_Source_Log_Pos(the fetch position the backlog is measured against).SELECT * FROM performance_schema.replication_connection_status\Gfor the modern view of the IO thread’s progress.SHOW VARIABLES LIKE 'binlog_expire_logs_seconds';andSHOW VARIABLES LIKE 'max_binlog_size';to understand retention and file rollover.
Source_Log_File/Read_Source_Log_Pos and the primary’s current file/position.
Why our number may legitimately differ from a manual calculation:
Managed-service note: Amazon RDS and Aurora do not expose a direct “binlog backlog MB” metric; use
ReplicaLag/AuroraReplicaLag (time-based) plus the binlog retention setting (call mysql.rds_set_configuration('binlog retention hours', N) on RDS) as the proxy. On Google Cloud SQL, replication is monitored via seconds_behind_master; binlog volume is inferred from binary-log storage growth. On all managed services the purge-safety concern still applies: ensure binlog retention exceeds your worst replica’s catch-up time.
Known limitations / FAQs
Why measure backlog in MB when I already have Seconds_Behind_Source? They answer different questions.Seconds_Behind_Source tells you how stale the replica’s data is in time. Backlog MB tells you how much binlog volume is queued, which is what governs purge safety. A replica can be only a few seconds behind in time yet have hundreds of MB queued during a write burst, and it is the volume, not the seconds, that determines whether the primary can safely purge a binlog file. Reading both gives you the complete picture.
The backlog is large but flat. Is that a problem?
Usually not. A large, stable backlog during a known heavy-write window (a batch import, a bulk update) is the replica working through a queue at a steady rate. The dangerous shape is a growing backlog, which means the replica is consuming slower than the primary produces and will keep falling behind. Watch the slope, not just the height.
How does a growing backlog actually break replication?
If the backlog grows large enough that the primary purges a binlog file the replica has not yet read, often because binlog_expire_logs_seconds is too low or disk pressure forces an early purge, the replica’s IO thread errors with 1236 (“could not find first log file”). Replication then stops dead and the replica must be re-cloned. Backlog growth is the early warning; raising binlog retention and speeding up apply prevents the break.
Why does the card report the worst replica rather than an average?
Because the slowest replica is the one that matters for both risk concerns: it gates how aggressively the primary can purge binlogs (you must retain anything the slowest replica has not read), and it is the worst failover candidate. An average would hide a single badly lagging replica behind several healthy ones. The card surfaces the worst case so you act on the real risk.
Can I reduce backlog by speeding up the replica?
Yes, that is the primary long-term lever. Enable multi-threaded apply with replica_parallel_workers (and replica_parallel_type = LOGICAL_CLOCK) so the replica applies independent transactions in parallel instead of single-threaded. Right-sizing the replica’s CPU and IO, and ensuring it is not also serving heavy read traffic during write bursts, also help. On the primary side, breaking very large transactions into smaller batches reduces the apply stalls that let backlog build.
Does a stopped replica thread show up here?
Yes, and dramatically. If a replica’s IO or SQL thread stops, it stops consuming binlog entirely, so the backlog against it grows without bound until someone intervenes. This card will climb steadily; cross-reference Replication Threads Stopped or Lag Exceeds Threshold, which fires the hero alert on the stopped thread itself.
Can I change the 1GB threshold?
Yes, it is configurable per profile in the Alert Rules tab. Instances that routinely run large overnight batches may have a higher healthy backlog and want the threshold raised so the card only fires on genuine fall-behind. Set it above your normal batch peak but well below the point where binlog retention would risk a purge break.