Quick revision
The short answer
The stalls happen because the redo log is almost full: InnoDB cannot reuse redo space until the dirty pages it protects are written to the data files, so when the checkpoint age gets close to capacity it switches to aggressive synchronous flushing and makes writers wait. The fixes are more redo capacity (innodb_redo_log_capacity, dynamic since MySQL 8.0.30), flushing tuned to what the storage can really do with innodb_io_capacity and adaptive flushing, and checking the storage itself, because burst-limited cloud volumes often cause exactly this pattern. A bigger redo log means a longer crash recovery, so we agree that trade-off with the service owners.
What to remember
In this answer, we saw that write stalls with the checkpoint age near capacity come from InnoDB's sync flush: it cannot reuse redo space until the dirty pages it protects are written, so writers wait. We give the redo log more room with innodb_redo_log_capacity, which is dynamic since 8.0.30, set innodb_io_capacity and io_capacity_max from what the storage really sustains with adaptive flushing on, check for burst-limited cloud volumes, plan the move to 8.4, and size everything within a crash recovery time the service owners accept.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
The stalls happen because the redo log is almost full: InnoDB cannot reuse redo space until the dirty pages it protects are written to the data files, so when the checkpoint age gets close to capacity it switches to aggressive synchronous flushing and makes writers wait. The fixes are more redo capacity (innodb_redo_log_capacity, dynamic since MySQL 8.0.30), flushing tuned to what the storage can really do with innodb_io_capacity and adaptive flushing, and checking the storage itself, because burst-limited cloud volumes often cause exactly this pattern. A bigger redo log means a longer crash recovery, so we agree that trade-off with the service owners.
Why this question is asked
Periodic freezes of several seconds are among the most alarming things a write-heavy database can do: everything looks healthy, then every insert waits at once, and then it recovers as if nothing happened. Interviewers ask about it because the cause sits in how InnoDB balances its redo log against page flushing, and the right fix depends on reading a few numbers correctly instead of raising every setting. In this answer, we will recap checkpoints and checkpoint age, see why a full redo log freezes writes, and then go through the capacity, flushing and storage options, the version upgrade, and the recovery time trade-off.
1A Quick Recap of Checkpoints and Checkpoint Age
When a transaction changes a page, InnoDB writes a redo record and leaves the changed page dirty in the buffer pool. The redo log is reused in a circle. Each position in it is identified by a log sequence number, LSN, which only grows. The checkpoint is the LSN up to which every change is already in the data files, so redo before it is no longer needed and its space can be reused.
The checkpoint age is the distance between the newest LSN and the last checkpoint: how much redo is still protecting dirty pages. It grows as we write and shrinks as page cleaner threads flush dirty pages and the checkpoint moves forward. As long as flushing keeps up with writing, the age stays well below the redo capacity.
With 100 MB of redo capacity, an age of 79 MB means we are already close to the edge.
2Why a Full Redo Log Freezes Writes
InnoDB flushes gently in the background, and adaptive flushing increases the rate as the checkpoint age grows. When the age passes an asynchronous threshold, around three quarters of capacity, InnoDB flushes harder. When it approaches a synchronous threshold, close to the full capacity (the exact points depend on the version), InnoDB has no choice: it cannot write new redo over space that still protects dirty pages, so user threads wait while pages are flushed to free space. That is the sync flush, and it is the several-second freeze we see.
So the freeze is not caused by any slow query. It is caused by redo being consumed faster than dirty pages are written, with too little redo space to absorb the difference during a burst.
| Checkpoint age | What InnoDB does | What clients feel |
|---|---|---|
| low | background flushing at io_capacity | nothing |
| rising | adaptive flushing speeds up | a little more I/O |
| about 3/4 of capacity | asynchronous aggressive flushing | higher write latency |
| near capacity | sync flush: writers wait for pages | stalls of seconds |
3Option 1: Give the Redo Log More Room
A larger redo log absorbs write bursts and lets the page cleaners flush at a steady rate. In MySQL 8.0.30 and later, innodb_redo_log_capacity replaces the older pair of settings and can be changed while the server runs. Before 8.0.30, the size came from innodb_log_file_size times innodb_log_files_in_group and needed a restart.
A practical way to size it is to measure how much redo we write in an hour of peak traffic, by sampling the LSN twice, and to hold at least that much, often an hour's worth. A busy primary writing 2 GB of redo per hour at peak would get roughly 2 to 8 GB, not the 100 MB default.
4Option 2: Let Flushing Match the Storage
innodb_io_capacity tells InnoDB how many I/O operations per second it may use for background flushing, and innodb_io_capacity_max is the ceiling when it falls behind. If they are set far below what the storage can do, the page cleaners flush too slowly and the age climbs; the 8.0 default of 200 was set for spinning disks, and 8.4 raised it (check your version). If they are set far above what the storage can sustain, flushing competes with reads and the disk saturates. We set them from a measurement of the volume's sustained IOPS, for example 4,000 and 8,000 on a volume that sustains 10,000, and keep adaptive flushing on (innodb_adaptive_flushing, with innodb_adaptive_flushing_lwm deciding when it starts).
5Option 3: Check the Storage Itself
Before tuning, we check whether the disk is the real limit. Cloud volumes often have a baseline and a burst: a volume may give 3,000 IOPS steadily and more only while burst credits last, or throttle throughput at a fixed number of MB per second. A workload that stalls in the late afternoon every day, after hours of heavy writes, is a classic sign of burst credits running out. The cloud metrics for the volume, such as queue depth, throughput against its limit and burst balance, show this directly, and the fix may be a provisioned-IOPS volume rather than any MySQL setting.
The upgrade path matters too. MySQL 8.0 reached end of life in April 2026, and 8.4 LTS keeps the dynamic redo capacity and has better defaults for SSD storage. Upgrading removes a support risk and gives us those defaults, but we still size redo and io_capacity for our own workload.
6The Price of a Bigger Redo Log
A larger redo log is not free. After a crash, InnoDB must replay all redo since the last checkpoint, so more redo and a larger checkpoint age mean a longer recovery before the server accepts connections. With 100 MB it might take seconds; with tens of gigabytes and a large buffer pool it can take minutes. If the service fails over to a replica, the primary's recovery time matters less; if it waits for the same host, it matters a lot. So we agree an acceptable recovery time with the service owners, size the redo log within it, and confirm it by killing mysqld on a test copy under load and timing the restart.
7Follow-up questions
How do we confirm the stalls are sync flushes and not locks?
We correlate the freezes with the checkpoint age and flushing metrics: Innodb_buffer_pool_pages_dirty, the checkpoint age from the LOG section or the redo status variables, and pages flushed per second. If the age reaches near capacity exactly when writes freeze, and lock waits in performance_schema stay flat, it is flushing. SHOW ENGINE INNODB STATUS during a freeze also shows threads waiting on the log or on page flushes.
Should we just turn off the doublewrite buffer or relax durability to speed flushing?
Not on a primary that matters. Disabling doublewrite risks torn pages after a crash, and relaxing innodb_flush_log_at_trx_commit risks losing committed transactions. The stall is a capacity and flushing problem, and it has safe fixes.
Does a bigger buffer pool help?
It can make it worse if redo stays small, because more dirty pages can accumulate behind the same redo space. The buffer pool size and the redo capacity should be sized together.
8Conclusion
In this answer, we saw that write stalls with the checkpoint age near capacity come from InnoDB's sync flush: it cannot reuse redo space until the dirty pages it protects are written, so writers wait. We give the redo log more room with innodb_redo_log_capacity, which is dynamic since 8.0.30, set innodb_io_capacity and io_capacity_max from what the storage really sustains with adaptive flushing on, check for burst-limited cloud volumes, plan the move to 8.4, and size everything within a crash recovery time the service owners accept.
Open with
This is the redo log filling up. InnoDB reuses redo space in a circle, and it can only reuse space once the dirty pages that redo protects have been flushed and the checkpoint has moved forward.
Then, if they want more
The checkpoint age measures how much redo is still needed. When writes outrun flushing and the age gets close to capacity, InnoDB switches to a sync flush and user threads wait until pages are written, which is the several-second freeze. First I would confirm it by lining up the stalls with the checkpoint age, dirty pages and flush rate.
Then the fixes: give the redo log more room, and on 8.0.30 or later innodb_redo_log_capacity is dynamic, so I can raise it from the 100 MB default to a few gigabytes, roughly an hour of peak redo; on older versions it is innodb_log_file_size and a restart.
I would set innodb_io_capacity and io_capacity_max from the volume's measured sustained IOPS and keep adaptive flushing on. I would also check the storage, because cloud volumes with burst credits or throughput caps produce exactly this daily pattern, and plan the upgrade to 8.4 since 8.0 is end of life.
The cost of more redo is a longer crash recovery, so I would agree an acceptable recovery time with the service owners and test it by killing mysqld under load.
About this answer
- Last updated
- 12 November 2026
- Versions it names
- MySQL 8.0
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- MySQL reference manual
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "A write-heavy MySQL 8.0 primary shows periodic stalls of several seconds where writes...": https://scrivio-interview-library.netlify.app/databases/mysql/1b45faedd7/