Commit latency jumps on the primary. CPU and disk there look fine, and no row locks explain it. One slow secondary is probably throttling the whole group through flow control, or certification is the bottleneck. Work down this runbook.
How a commit is held up
A transaction is executed locally, broadcast at commit, certified on every member, then applied on the secondaries from a queue. Commit doesn't wait for the apply by default. Flow control is the brake: each member shares statistics every second, and writers get a smaller quota when any member's queue passes a threshold.
| Stage | Symptom | Evidence |
|---|---|---|
| Group communication | Every commit slow, steady | Network RTT, slow member, suspected members |
| Certification | Queue pending conflict detection grows | COUNT_TRANSACTIONS_IN_QUEUE |
| Apply | One member's applier queue grows | COUNT_TRANSACTIONS_REMOTE_IN_APPLIER_QUEUE |
| Flow control | Throughput drops in steps, then recovers | Queue above threshold |
| Consistency level | Reads or commits wait for other members | group_replication_consistency |
Step 1: Check membership
SELECT member_host, member_port, member_state, member_role, member_version
FROM performance_schema.replication_group_members;
A member in RECOVERING is catching up. An UNREACHABLE member slows group communication until it returns or is expelled. Fix that before tuning anything.
Step 2: Find the member with the queue
Run on any member:
SELECT m.member_host, m.member_role,
s.count_transactions_in_queue AS certify_q,
s.count_transactions_remote_in_applier_queue AS apply_q,
s.count_conflicts_detected AS conflicts,
s.count_transactions_rows_validating AS cert_rows,
s.count_transactions_local_rollback AS local_rb
FROM performance_schema.replication_group_member_stats s
JOIN performance_schema.replication_group_members m
ON m.member_id = s.member_id AND m.channel_name = s.channel_name;
Remote rows are refreshed periodically, so confirm on the suspect member itself. Sample every five seconds and compare with the thresholds:
SHOW GLOBAL VARIABLES LIKE 'group_replication_flow_control%';
SELECT @@group_replication_consistency, @@group_replication_transaction_size_limit;
The certifier and applier thresholds are both 25,000 transactions by default. A queue at or above either one means throttling is expected. A queue of 2,000 doesn't explain a stall; look at steps 1 and 5.
Tip
The queue is counted in transactions. Ten huge transactions can put a secondary minutes behind without ever reaching the threshold, so watch apply delay as well.
Step 3: Find why that member applies slowly
SELECT channel_name, worker_id, service_state, last_error_number,
applying_transaction,
TIMESTAMPDIFF(SECOND, applying_transaction_original_commit_timestamp, NOW(6)) AS lag_s
FROM performance_schema.replication_applier_status_by_worker
WHERE channel_name = 'group_replication_applier'
AND applying_transaction <> '';
SELECT @@replica_parallel_workers, @@replica_preserve_commit_order,
@@innodb_flush_log_at_trx_commit, @@sync_binlog,
@@innodb_buffer_pool_size;
| What you see | Cause | Fix |
|---|---|---|
| One worker busy, others idle | Big or dependent transactions | Split batches; avoid hot rows |
| All workers busy, disk saturated | Undersized storage | Match the primary's storage |
| All busy, high read I/O | Cold or smaller buffer pool | Match memory; warm it up |
| Workers wait on locks | Backup or long local transaction | End it or move it |
| Same queue after restart | Different settings on this member | Diff variables across members |
Group Replication secondaries need the same hardware as the primary. A smaller "reporting" member sets the write rate of the group.
Look for a long-running local transaction or a backup lock:
SELECT trx_mysql_thread_id, trx_started, trx_rows_locked, trx_state
FROM information_schema.innodb_trx
ORDER BY trx_started LIMIT 10;
SELECT object_type, object_schema, object_name, lock_type, lock_status
FROM performance_schema.metadata_locks
WHERE lock_status = 'PENDING' OR object_type = 'BACKUP LOCK';
Step 4: Relieve the stall
Pick one. The least risky comes first.
- Pause the load that creates the queue: batch jobs, purges, backfills.
- Stop the blocker on the slow member: the backup, the report, the idle transaction.
- Take the slow member out of the group if the rest have quorum and enough redundancy:
-- On the slow secondary only
STOP GROUP_REPLICATION;
Caution
In a three-member group this leaves two members, and losing one more can cost you quorum and block writes. Confirm the other two are
ONLINEfirst, and drain the member from MySQL Router or your load balancer. Rejoin it as soon as it is healthy; if the needed binary logs are purged or the gap is large, it may have to be cloned.
- Loosen flow control temporarily. These variables are dynamic and don't need a Group Replication restart. Set the same values on all members:
SET GLOBAL group_replication_flow_control_applier_threshold = 100000;
-- or, last resort
SET GLOBAL group_replication_flow_control_mode = 'DISABLED';
Warning
Disabling flow control doesn't make the secondary faster. The backlog grows, relay logs use disk, reads go stale, and a failover to that member must work through the queue before it is current. Write down when you will turn it back on.
Step 5: Check the less obvious causes
Large transactions
group_replication_transaction_size_limit defaults to 150,000,000 bytes; larger transactions are rolled back. Transactions just below it still stall communication and apply. Find them in the binary log on the primary:
mysqlbinlog --base64-output=DECODE-ROWS binlog.000123 \
| grep -o 'transaction_length=[0-9]*' \
| cut -d= -f2 | sort -n | tail -10
Delete and update in chunks, with a commit for each chunk:
DELETE FROM audit_log
WHERE created_at < '2026-01-01'
ORDER BY id
LIMIT 5000;
Loop until zero rows are affected. Use an index that matches the filter and order.
Certification data and garbage collection
count_transactions_rows_validating counts certification rows not yet garbage collected. Rows can only be removed once the transactions are committed on all members. So one lagging member makes the certification data grow everywhere, which costs memory and CPU. If the count climbs without falling, fix the laggard.
Conflicts in multi-primary mode
If count_conflicts_detected climbs, sessions on different members write the same rows; the later one is rolled back at commit. Retry loops multiply the load. Route writes for a data set to one member or use single-primary mode.
Consistency level
SELECT @@GLOBAL.group_replication_consistency;
AFTER and BEFORE_AND_AFTER make commits wait until the transaction is applied elsewhere, so one slow secondary slows each commit even with no flow control. BEFORE makes the new transaction wait for the backlog. If only a few operations need it, set it per session:
SET SESSION group_replication_consistency = 'BEFORE';
Check that the global value wasn't raised for one application. In 8.4 the default is BEFORE_ON_PRIMARY_FAILOVER; in 8.0 it is EVENTUAL.
Step 6: Tune deliberately
Variable (prefix group_replication_flow_control_) | Default | When to change |
|---|---|---|
applier_threshold | 25000 | Lower for small failover gaps; raise to absorb bursts |
certifier_threshold | 25000 | Rarely |
min_quota | 0 | Set a floor so writers never fall to a trickle |
min_recovery_quota | 0 | Keep write capacity while a member recovers |
hold_percent | 10 | Raise to let the backlog drain faster |
release_percent | 50 | Lower for a gentler ramp after throttling |
period | 1 s | Leave it |
Choose the applier threshold from your failover objective:
threshold ≈ measured apply rate (transactions/s) × acceptable catch-up seconds
For 2,000 transactions/s applied and 5 seconds of catch-up, start at 10,000. A floor is the safer way to protect throughput than disabling the mode:
SET PERSIST group_replication_flow_control_min_quota = 500;
Set that floor below what the slowest member can sustain, or the backlog grows without limit.
To add applier workers, change one secondary at a time and restart replication on it:
STOP GROUP_REPLICATION;
SET PERSIST replica_parallel_workers = 16;
START GROUP_REPLICATION;
Wait for ONLINE and an empty queue before the next member. Keep replica_preserve_commit_order = ON.
Prevent it next time
- Alert on applier queue above 25% of the threshold for two minutes, and on oldest apply delay in seconds.
- Keep hardware, buffer pool and durability settings identical on every member that can become primary.
- Enforce batch sizes in code review, and lower
group_replication_transaction_size_limitonce the code complies. - Run backups from a secondary you monitor, and include the applier queue in the backup job's abort condition.
- Rehearse losing the laggard: know your write rate with two members and how long a rejoin takes.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get