Skip to content

feat(mysql-innodb-buffer-pool-size): show the pool usage, warn on waits for a free page - #1670

Open
NavidSassan wants to merge 1 commit into
mainfrom
feat/mysql-innodb-buffer-pool-size-usage-waits
Open

NavidSassan wants to merge 1 commit into
mainfrom
feat/mysql-innodb-buffer-pool-size-usage-waits

Conversation

@NavidSassan

Copy link
Copy Markdown
Member

Builds on 85dad20 (miss ratio). The miss ratio rule itself is unchanged.

What changes

  • Pool usage: the size line reports how much of the buffer pool is in use and whether it is full, that is down to the reserve of free pages InnoDB keeps (innodb_lru_scan_depth, per instance on MySQL). Informational only. New perfdata mysql_innodb_buffer_pool_bytes_data and mysql_innodb_buffer_pool_pct_used, new Grafana panel "Usage".
  • Waits for a free page: WARN when Innodb_buffer_pool_wait_free moved since the last check, with --warning-waits (default 0) for servers where bulk loads may run into it. MariaDB from 10.6.18, 10.11.8 and 11.4.2 waits up to a second per count, older MariaDB and MySQL count every retry.
  • README: how the pool fills, how to read the numbers, how to size it, troubleshooting for waits.

Verification

  • Container suite passes on all 7 images (MariaDB 10.6, 10.11, 11.4, 11.8, MySQL 8.0, 8.4, 9.3).
  • "Full" with 8 buffer pool instances measured on MySQL 8.0.46 and 8.4.13: a 1 GiB pool sits at 8192 to 9586 free pages when idle, 0 under read load.
  • The test server runs with --innodb-lru-scan-depth=256, because a 32 MiB pool with the default reserve settles anywhere between 24% and 55% in use on MariaDB.

Known limits

  • A pool below about twice the reserve (48 MiB on MariaDB) is not reliably recognised as full.
  • No test triggers the waits warning; it needs a write load the suite does not produce. The test asserts that reads alone cause none.
  • The usage figures in two README examples (24.1% and 41.7%) are composed, not captured.

Not part of this PR, for discussion

Measured with a 64 MiB pool in front of 150 MiB of data, each phase 30 s:

Server Random lookups only Scans only, as computed Scans only, without subtracting read-ahead
MariaDB 11.4.13 17.1% 1.2% 87.3%
MariaDB 10.5.29 14.6% 0.0% 4.6%
MySQL 8.4.13 12.3% 0.0% 9.4%
MySQL 8.0.46 12.2% 7.5% 14.2%
  1. Random primary key lookups on a pool 2.3 times too small stay below the 20% default on all four servers.
  2. MySQL and MariaDB before 10.6.13 / 10.11.3 do not count linear read-ahead in Innodb_buffer_pool_reads (buf0rea.cc), so subtracting Innodb_buffer_pool_read_ahead removes real misses there. With lookups and scans mixed, MariaDB 10.5.29 came to 8.4% instead of 12.1%.

…ts for a free page

- Report how much of the buffer pool is in use and whether it is full,
  that is down to the reserve of free pages InnoDB keeps
  (innodb_lru_scan_depth, per instance on MySQL). New perfdata
  mysql_innodb_buffer_pool_bytes_data and _pct_used, new Grafana panel.
- WARN when Innodb_buffer_pool_wait_free moved since the last check,
  --warning-waits (default 0) for servers where bulk loads may run into
  it. MariaDB from 10.6.18, 10.11.8 and 11.4.2 waits up to a second per
  count, older MariaDB and MySQL count every retry.
- README: how the pool fills, how to read the numbers, how to size it.

Verified on MariaDB 10.6.28, 10.11, 11.4.13, 11.8.9 and MySQL 8.0.46,
8.4.13, 9.3. "Full" with 8 buffer pool instances measured on MySQL 8.0.46
and 8.4.13 (1 GiB pool: 8192 to 9586 free pages when idle). A pool below
about twice the reserve (48 MiB on MariaDB) is not reliably recognised
as full.
@NavidSassan
NavidSassan requested a review from markuslf November 13, 2026 16:02

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant