iostat shows sustained disk writes, query latency creeps up under load, and users complain about slow page loads. The hit ratio is not lying, but it is not telling you the whole story. A high read hit ratio means most data reads come from memory. It says nothing about how aggressively InnoDB is writing dirty pages back to disk, or whether the buffer pool has any free pages left to absorb new data without evicting something first.
This article walks through the investigation pattern as a post-mortem: what the symptoms look like, where the standard metric misleads you, what numbers actually matter, and how to fix it.
Initial impact: queries slow under write-heavy traffic
max_connections, table locks — finds nothing obvious.
The hit ratio formula looks like this:
hit ratio = 1 - (Innodb_buffer_pool_reads / Innodb_buffer_pool_read_requests)
Innodb_buffer_pool_reads counts physical disk reads that happened because a page was not in the buffer pool. Innodb_buffer_pool_read_requests counts total logical read requests served from the pool. When the ratio is 99%+, almost every read request finds its page in memory. Good.
But this metric only covers reads. It tells you nothing about writes flushing to disk.
Investigation: where the real numbers hide
SHOW ENGINE INNODB STATUS and INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS (available in MySQL 5.6+ and MariaDB equivalents, though column names may differ slightly between forks).
Run this to get the key counters:
SQL
SELECT
POOL_SIZE,
FREE_BUFFERS,
DATABASE_PAGES,
MODIFIED_DB_PAGES,
PAGES_MADE_YOUNG,
HIT_RATE
FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;- POOL_SIZE — total pages allocated to the buffer pool (each page is typically 16 KB).
- FREE_BUFFERS — pages not currently holding any data. When this hits zero, every new page load forces an eviction.
- DATABASE_PAGES — pages holding actual data.
- MODIFIED_DB_PAGES — "dirty pages." These hold data that has been changed in memory but not yet written back to the tablespace files on disk. This is the number most people never check.
- HIT_RATE — the read hit ratio, expressed per 1000 (so 999 means 99.9%).
SHOW ENGINE INNODB STATUS output. Look for the BUFFER POOL AND MEMORY section:
TEXT
-- Illustrative output format (your numbers will differ)
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 1073741824
Buffer pool size 65536
Free buffers 12
Database pages 65420
Modified db pages 31200
Pending reads 0
Pending writes: LRU 0, flush list 48, single page 0
Pages made young 482010, not young 0Why the hit ratio stays high while performance degrades
innodb_io_capacity and innodb_io_capacity_max. When the percentage of dirty pages exceeds innodb_max_dirty_pages_pct (default varies by version — often 75 or 90), flushing becomes more aggressive. When the redo log (write-ahead log) fills up relative to checkpoint age, flushing becomes synchronous and everything stalls.
So the scenario is: buffer pool large enough to cache reads, but not large enough (or not flushing fast enough) to handle the write workload without I/O pressure.
Temporary mitigation: tune flushing, not the pool size
innodb_io_capacity (typically 200) might be appropriate. On SSD or NVMe storage, that default is far too conservative.
Check current values:
SQL
SHOW VARIABLES LIKE 'innodb_io_capacity%';
SHOW VARIABLES LIKE 'innodb_max_dirty_pages_pct%';innodb_io_capacity is still 200, raising it to match your disk's actual write throughput lets InnoDB flush dirty pages faster in the background, reducing the chance of synchronous checkpoints. Values depend entirely on your hardware — there is no universal number. Start by checking your disk's sustained write IOPS with a tool like fio or your hosting provider's published specs, then set innodb_io_capacity to roughly 50-75% of that.
Lowering innodb_max_dirty_pages_pct (for example, from 75 to 50) forces InnoDB to start flushing earlier, keeping the dirty page count lower at the cost of more constant background I/O. Whether that trade-off helps depends on your workload pattern.
Architectural fix: right-size the buffer pool using actual data
innodb_buffer_pool_size to 60-80% of total RAM on a dedicated database server — is a starting point, not an answer. On shared hosting or a VPS running a web server, mail, and MySQL together, 60-80% of RAM would starve everything else.
The real question: is your working dataset larger than the buffer pool? Check:
-
Total InnoDB data size on disk:
Query
INFORMATION_SCHEMA.TABLESto sum upDATA_LENGTH + INDEX_LENGTHfor all InnoDB tables. If that total exceeds your buffer pool size, not everything fits in memory. Whether that matters depends on how much of that data is actively queried. -
Free buffers over time:
If
FREE_BUFFERSstays near zero during normal operation (not just peak), the pool is full. Every new page requires evicting an old one. If the evicted page is dirty, it must be flushed first — adding write I/O. -
Pages made young vs. not young:
In
SHOW ENGINE INNODB STATUS, "pages made young" counts pages promoted from the old sublist to the young sublist of the LRU (least recently used) list. A high rate of "not young" pages means full table scans or large queries are touching pages that get evicted before they are reused. This is normal for occasional reports but problematic if constant.
innodb_buffer_pool_size. In MySQL 5.7+ you can resize it online (the server adjusts in chunks), but verify your version supports this before relying on it. On older versions, a restart is required.
After resizing, monitor FREE_BUFFERS and MODIFIED_DB_PAGES over a full traffic cycle (at least 24 hours). The goal is not zero dirty pages — dirty pages are normal and expected. The goal is that dirty pages stay well below the threshold that triggers aggressive flushing, and free buffers remain available so evictions do not cascade into write storms.
What to take away
innodb_io_capacity matches your actual storage. The fix is usually a combination of right-sizing the pool and tuning flush aggressiveness — not blindly adding RAM until the ratio hits 100%.