Skip to content

LRU perf patches#6007

Draft
polchawa-percona wants to merge 3 commits into
percona:8.4from
polchawa-percona:lru-perf-patches-2
Draft

LRU perf patches#6007
polchawa-percona wants to merge 3 commits into
percona:8.4from
polchawa-percona:lru-perf-patches-2

Conversation

@polchawa-percona

@polchawa-percona polchawa-percona commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

IMPORTANT: it is PoC - not production ready! and has no support for compressed pages - but should be easy to restore

Recommended to set:

  • innodb_lru_make_young_drain_threshold = 256 # 64-256
  • innodb_single_page_flush_max_concurrent = 16 # 4, 8, 16, 1000
  • innodb_lru_flush_batch_size = 10 # 1, 10, 16, 64

The list of applied patches:

  1. Shortened scope for which LRU list mutex is acquired in buf_init_for_read.
  2. Deferring when pages are made young, so promotion can happen in batches and we reduce the number of times the LRU list mutex has to be acquired (deferring is lock-free).
  3. Made the "await LRU flush" optimization conditional - based on number of pending single page flushes.
  4. Restored the Percona LRU thread manager that was removed in some 8.0 version.
  5. Optimized the LRU flushing:
    a. grouping pages to evict/flush into tiny batches to reduce number of times the LRU list mutex has to be released and reacquired internally in the loop.
    b. preparing a new list of batched free pages outside the free_list mutex section, and then doing O(1) concatenation of lists under the mutex only

Please note that the following two parameters make significant differences for all tested versions in this test:

  • innodb_buffer_pool_instances = 2 / 8  => reduces contention on LRU list mutexes (each BP instance has its own LRU list and mutex)
  • innodb_lru_scan_depth_size = 100 / 300 / 1000 => for higher number of threads we might want to allow deeper scans to be able to reclaim more pages

Especially the innodb_buffer_pool_instances set to higher values, can result in better shape for TPS curve by reducing the LRU list mutex contention further...

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

Labels

None yet

1 participant