Rechercher dans le manuel MySQL
15.8.3.5 Configuring InnoDB Buffer Pool Flushing
InnoDB
performs certain tasks in the
background, including flushing
of dirty pages (those
pages that have been changed but are not yet written to the
database files) from the buffer
pool.
InnoDB
starts flushing buffer pool pages when
the percentage of dirty pages in the buffer pool reaches the low
water mark setting defined by
innodb_max_dirty_pages_pct_lwm
.
This option is intended to control the ratio of dirty pages in
the buffer pool and ideally prevent the percentage of dirty
pages from reaching
innodb_max_dirty_pages_pct
. If
the percentage of dirty pages in the buffer pool exceeds
innodb_max_dirty_pages_pct
,
InnoDB
begins to aggressively flush buffer
pool pages.
InnoDB
uses an algorithm to estimate the
required rate of flushing, based on the speed of redo log
generation and the current rate of flushing. The intent is to
smooth overall performance by ensuring that buffer flush
activity keeps up with the need to keep the buffer pool
“clean”. Automatically adjusting the rate of
flushing can help to avoid sudden dips in throughput, when
excessive buffer pool flushing limits the I/O capacity available
for ordinary read and write activity.
InnoDB
uses its log files in a circular
fashion. Before reusing a portion of a log file,
InnoDB
flushes to disk all dirty buffer pool
pages whose redo entries are contained in that portion of the
log file, a process known as a
sharp checkpoint.
If a workload is write-intensive, it generates a lot of redo
information, all written to the log file. If all available space
in the log files is used up, a sharp checkpoint occurs, causing
a temporary reduction in throughput. This situation can happen
even if
innodb_max_dirty_pages_pct
is
not reached.
InnoDB
uses a heuristic-based algorithm to
avoid such a scenario, by measuring the number of dirty pages in
the buffer pool and the rate at which redo is being generated.
Based on these numbers, InnoDB
decides how
many dirty pages to flush from the buffer pool each second. This
self-adapting algorithm is able to deal with sudden changes in
workload.
Internal benchmarking has shown that this algorithm not only maintains throughput over time, but can also improve overall throughput significantly.
Because adaptive flushing can significantly affect the I/O
pattern of a workload, the
innodb_adaptive_flushing
configuration parameter lets you turn off this feature. The
default value for
innodb_adaptive_flushing
is
ON
, enabling the adaptive flushing algorithm.
You can set the value of this parameter in the MySQL option file
(my.cnf
or my.ini
) or
change it dynamically with the
SET
GLOBAL
statement, which requires privileges sufficient
to set global system variables. See
Section 5.1.9.1, “System Variable Privileges”.
For information about fine-tuning InnoDB
buffer pool flushing behavior, see
Section 15.8.3.6, “Fine-tuning InnoDB Buffer Pool Flushing”.
For more information about InnoDB
I/O
performance, see Section 8.5.8, “Optimizing InnoDB Disk I/O”.
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-innodb-performance-adaptive_flushing.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.