您的位置:首页 > Web前端

Configuring InnoDB Buffer Pool Flushing

2017-06-27 21:12 405 查看
翻译自5.7官方文档
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 在后台执行一些任务,包括从缓冲池刷脏页(这些页面已经被改变但是还没有写入数据库文件)

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_max_dirty_pages_pct_lwm设置的低水位线时,开始刷脏页。这个选项旨在控制缓冲池中的脏页比率,并且理想地组织脏页百分比达到innodb_max_dirty_pages_pct设置的值。如果缓冲池中的脏页比率超过了innodb——max_dirty_pages_pct, innodb开始积极的刷缓冲页。

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 使用算法估计需要的刷新速率,根据事务日志的生成速度和当前的刷新速率。目的是在保证缓冲池‘干净的前提下’ 尽可能的平滑整体性能。自动调整冲洗速率有助于避免过多的缓冲池冲洗限制了可用于普通读写活动的I / O容量,从而避免吞吐量突然下降。

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 用循环的方式使用日志文件。再重用这部分日志文件之前,会使用 sharp checkpoint 线程 将包含那部分redo 条目的脏缓冲页刷到磁盘上。如果程序写密集型,会产生很多的redo信息。如果日志文件的可用空间被用光了,则会出现尖锐检查点,造成吞吐量暂时降低。即使还未达到innodb_max_dirty_pages_pct,这种情况也会发生。

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.

InnoDB使用基于启发式的算法来避免这种情况,通过测量缓冲池中的脏页数和生成redo的速率。 根据这些数据,InnoDB决定每秒从缓冲池中刷新多少个脏页面。 这种自适应算法能够处理工作量的突然变化。

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
command, which requires the
SUPER
privilege.

因为自适应刷新可能会显着影响工作负载的I / O模式,所以innodb_adaptive_flushing配置参数可让你关闭此功能。默认值是on,你可以再配置文件中设置该参数或者使用set global 命令动态设置,需要super权限

For information about fine-tuning
InnoDB
buffer pool flushing behavior, see Section 14.6.3.7, “Fine-tuning InnoDB Buffer Pool Flushing”.
For more information about
InnoDB
I/O performance, see Section 8.5.8, “Optimizing InnoDB Disk I/O”.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息