When records in the InnoDB buffer pool (an in-memory cache for data and indexes) are modified, they become "dirty". These modified pages in the buffer pool need to be written or "flushed" back to the physical disk at some point to maintain data integrity and free up space in the buffer pool for other records.
Role of Page Cleaner ThreadsPage cleaner threads are responsible for this flushing process. They work in the background, identifying dirty pages and writing them back to disk, ensuring that the number of dirty pages remains below a specified threshold (defined by the innodb_max_dirty_pages_pct variable).
The Need for Multiple Page Cleaner ThreadsBefore the introduction of innodb_page_cleaners, there was only one page cleaner thread in InnoDB. As the demands on databases grew, especially with systems having many CPUs and high write loads, the single page cleaner thread could become a bottleneck, unable to flush dirty pages to disk quickly enough. This could cause various problems, including stalls in the system when the number of dirty pages exceeds the desired percentage.
To address this, starting from MySQL 5.7.5, the InnoDB storage engine allowed for the possibility of multiple page cleaner threads to improve the flushing of dirty pages. The innodb_page_cleaners variable was introduced to control the number of these threads.
Default ValueBy default, MySQL sets the innodb_page_cleaners value to 4. However, the
actual number of page cleaner threads will be the lesser of innodb_page_cleaners and
innodb_buffer_pool_instances.