MySQL InnoDB Redo Log & Checkpoint Stall Tuning Prompt
Diagnose write stalls and checkpoint bursts caused by an undersized or misconfigured InnoDB redo log, and size redo capacity and flushing for the workload.
- Target user
- DBAs and SREs troubleshooting InnoDB write stalls and checkpoint pressure
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior MySQL/MariaDB DBA who tunes InnoDB write path performance. You understand the redo log and how it differs from the buffer pool: the redo log absorbs write-ahead records, and when it fills, InnoDB must force **synchronous checkpoint flushing** of dirty pages, causing periodic write stalls. You know innodb_redo_log_capacity (MySQL 8.0.30+), the older innodb_log_file_size × innodb_log_files_in_group (and MariaDB's innodb_log_file_size), the checkpoint age, innodb_io_capacity / _max, innodb_max_dirty_pages_pct, and the "async/sync flush" watermarks visible in SHOW ENGINE INNODB STATUS. I will provide: - Host and storage (RAM, CPU, NVMe/SSD/network disk and its real write IOPS/throughput): [PASTE] - Current settings from `SHOW GLOBAL VARIABLES` (innodb_redo_log_capacity or innodb_log_file_size/_files_in_group, innodb_io_capacity, innodb_io_capacity_max, innodb_max_dirty_pages_pct, innodb_flush_neighbors, innodb_flush_method): [PASTE] - The LOG section of `SHOW ENGINE INNODB STATUS` (Log sequence number, Log flushed up to, Last checkpoint at — the gap is checkpoint age) and repeated samples so the redo write rate can be computed: [PASTE] - `SHOW GLOBAL STATUS` counters over an interval: Innodb_os_log_written, Innodb_buffer_pool_pages_dirty, Innodb_checkpoint_age (if exposed), Innodb_data_fsyncs: [PASTE] - The symptom: periodic latency spikes, stalls, "innodb_log_waits" incrementing, or throughput cliffs under write bursts: [DESCRIBE] Work through this: 1. **Compute the redo write rate** from Innodb_os_log_written across the samples (bytes/sec → per minute). State how many minutes of redo the current capacity holds — the classic target is roughly an hour of peak write-ahead, sized to the storage. 2. **Read the checkpoint age.** Derive it from LSN minus Last checkpoint and compare to capacity. An age near capacity plus rising Innodb_log_waits proves the redo log is the bottleneck and InnoDB is in aggressive sync flushing. 3. **Size redo capacity.** Recommend innodb_redo_log_capacity (8.0.30+) or the equivalent log_file_size × files_in_group / MariaDB log_file_size, large enough to smooth checkpoint bursts without an unbounded crash-recovery time. 4. **Match flushing to the disk.** Set innodb_io_capacity / _max to the storage's real sustained write IOPS (measured, not guessed) and reconsider innodb_flush_neighbors (0 on SSD/NVMe) and innodb_max_dirty_pages_pct so background flushing keeps pace with the redo rate. 5. **Weigh the recovery trade-off.** A bigger redo log means longer crash recovery; state the expected recovery window and whether it fits the SLA. Output: (a) Findings with the computed redo rate and checkpoint age, (b) Recommended values with before/after and rationale, (c) Which changes are online (SET GLOBAL, including dynamic redo resize on 8.0.30+) vs restart-required (older versions / MariaDB), (d) Metrics to watch after applying (Innodb_log_waits, checkpoint age, p99 latency). Guardrails: measure the redo rate before changing anything — do not copy a fixed number from a blog. Oversizing redo lengthens crash recovery; keep it within the SLA. On MySQL < 8.0.30 and MariaDB, changing the log file size requires a restart and a clean shutdown — plan a maintenance window and back up first. Never set innodb_io_capacity above what the disk can actually sustain, or you starve foreground IO.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Why this prompt works
Write stalls in InnoDB are routinely misdiagnosed as a slow-disk or buffer-pool problem when the real culprit is the redo log filling and forcing synchronous checkpoint flushes. This prompt separates the redo log from the buffer pool explicitly — a distinction many tuning guides blur — and drives the diagnosis from the one number that proves it: the checkpoint age (LSN minus last checkpoint) compared against redo capacity, backed by Innodb_log_waits incrementing.
It insists on measurement over folklore. Instead of pasting “set the log to 2 GB,” the model computes the actual redo write rate from Innodb_os_log_written across samples and sizes capacity to hold a target window of peak write-ahead. That grounds the recommendation in this server’s write pattern and this disk’s real sustained IOPS, which is the only way to set innodb_io_capacity without either starving foreground IO or letting dirty pages pile up.
The guardrails protect the two things people forget under pressure: a bigger redo log directly lengthens crash recovery, so it must fit the SLA, and on MySQL before 8.0.30 and on MariaDB the resize needs a clean shutdown and restart — not a live change. Flagging the online dynamic resize on 8.0.30+ versus the restart-required path elsewhere keeps the output honest about what can actually be applied without downtime.
Related prompts
-
MySQL Durability & Flush Settings Tuning Prompt
Balance InnoDB durability against throughput by reviewing flush, sync, and doublewrite settings for a given workload and hardware.
-
MySQL InnoDB Buffer Pool & Config Tuning Prompt
Right-size the InnoDB buffer pool and related memory/IO settings for a described workload and host.
-
MySQL InnoDB Buffer Pool Warmup Prompt
Configure buffer-pool dump/restore so a restarted or failed-over MySQL instance serves warm-cache latency immediately instead of a cold-cache stall.
-
MySQL InnoDB I/O Capacity & Flush Tuning Prompt
Right-size innodb_io_capacity, io_capacity_max, and page-flushing to match real storage IOPS and stop dirty-page or checkpoint stalls.
More MySQL prompts & error guides
Browse every MySQL prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.