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.
- Target user
- DBAs tuning InnoDB flushing to modern SSD/NVMe or cloud block storage
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior MySQL/MariaDB DBA who tunes InnoDB background flushing to the actual storage. You understand innodb_io_capacity, innodb_io_capacity_max, innodb_flush_neighbors, innodb_lru_scan_depth, adaptive flushing driven by redo-log fill and dirty-page ratio (innodb_max_dirty_pages_pct), and how a mismatch between configured capacity and real device IOPS causes either checkpoint stalls or wasted I/O. I will provide: - Current values: innodb_io_capacity, innodb_io_capacity_max, innodb_flush_neighbors, innodb_max_dirty_pages_pct, innodb_lru_scan_depth, buffer pool size, redo log capacity: [PASTE] - Storage type and its real, sustained (not burst) IOPS/throughput — from the cloud spec or an fio benchmark: [DESCRIBE] - Symptom: periodic write stalls, dirty-page ratio pinned high, checkpoint-age warnings, or sync flush waits: [DESCRIBE] - Relevant metrics: Innodb_buffer_pool_pages_dirty, Innodb_data_writes, checkpoint age from SHOW ENGINE INNODB STATUS: [PASTE] Work through this: 1. **Establish real device capability.** Insist on the sustained IOPS (from spec or fio), not burst — flush tuning to burst numbers on credit-based cloud volumes causes cliff stalls. State the number the config should target. 2. **Diagnose the flushing symptom.** Distinguish (a) dirty pages pinned near innodb_max_dirty_pages_pct with rising checkpoint age (flushing too slow — capacity too low or redo too small) from (b) high write IOPS with idle-ish foreground and low dirty ratio (flushing too aggressive — capacity too high). Use the metrics to decide which. 3. **Set io_capacity and io_capacity_max** to bracket the sustained device rate, leaving headroom for foreground reads/writes rather than consuming all IOPS for background flushing. 4. **Tune flush_neighbors** — 0 for SSD/NVMe (no benefit to coalescing adjacent pages), reconsider only for spinning disks. 5. **Relate to redo sizing.** If checkpoint age is the real constraint, note that larger redo log capacity (see the checkpoint tuning work) may matter more than io_capacity; keep the two coordinated. 6. **Roll out and measure.** One change at a time, watch dirty-page ratio, checkpoint age, and foreground latency before/after, with rollback values. Output: (a) The sustained IOPS target and why burst is excluded, (b) Which flushing symptom is present with metric evidence, (c) Recommended io_capacity / io_capacity_max / flush_neighbors, (d) Interaction with redo sizing, (e) One-at-a-time rollout and rollback. Guardrails: base capacity on measured sustained IOPS, never burst or a guessed large number; leave IOPS headroom for foreground query I/O rather than dedicating the device to background flushing; change one variable at a time and confirm dirty-page ratio and foreground latency improve before keeping it.
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
innodb_io_capacity is routinely set by copying a big number from a blog post, which is exactly the wrong instinct: telling InnoDB it has more IOPS than the disk can deliver makes background flushing hog the device and starve the queries users are waiting on. This prompt reframes the task as matching measured, sustained device capability rather than maximizing a number, which is the mental shift that makes the tuning correct.
The cloud-storage caveat is where it earns its keep. EBS and Persistent Disk volumes advertise burst IOPS that deplete on a credit system, so a config tuned to the burst rate runs fine in testing and then stalls periodically in production when credits run out. By insisting on the guaranteed sustained rate from the spec or an fio run, the prompt avoids a class of intermittent stall that is notoriously hard to diagnose after the fact.
It also refuses to treat io_capacity in isolation. When checkpoint age is the real constraint, enlarging the redo log matters more than any flush-rate knob, so the prompt keeps the two coordinated and diagnoses which symptom is actually present using dirty-page ratio and checkpoint age. The one-variable-at-a-time rollout with before/after measurement keeps the engineer from chasing their own tail across interacting settings.
Related prompts
-
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 Durability & Flush Settings Tuning Prompt
Balance InnoDB durability against throughput by reviewing flush, sync, and doublewrite settings for a given workload and hardware.
-
MySQL Disk Full & Tablespace Reclaim Prompt
Recover a MySQL/MariaDB instance from a full data disk and reclaim space from bloated InnoDB tablespaces, binary logs, undo, and temp files without corrupting data or triggering more downtime.
-
MySQL Unused & Redundant Index Audit Prompt
Find indexes that are never used or are duplicated/prefix-redundant, and decide which are safe to drop to cut write and storage overhead.
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.