14.6.3.7 Fine-tuning InnoDB Buffer Pool Flushing
作者:互联网
The configuration options innodb_flush_neighbors and innodb_lru_scan_depth let you fine-tune aspects of the flushing process for the InnoDB buffer pool.
配置选项innodb_flush_neighbors和innodb_lru_scan_depth允许您微调InnoDB 缓冲池的刷新过程的各个方面。
- innodb_flush_neighbors
Specifies whether flushing a page from the buffer pool also flushes other dirty pages in the same extent. When the table data is stored on a traditional HDD storage device, flushing neighbor pages in one operation reduces I/O overhead (primarily for disk seek operations) compared to flushing individual pages at different times. For table data stored on SSD, seek time is not a significant factor and you can disable this setting to spread out write operations.
指定是否从缓冲池中刷新页面时也会刷新相同extent上的其他脏页。当表数据存储在传统的HDD存储设备上时,在一个操作中刷新邻居页面会减少I/O开销(主要用于磁盘查找操作),而不是在不同时间刷新单个页面。对于存储在SSD上的表数据,寻址时间不是一个重要因素,您可以禁用此设置以分散写入操作。 -
innodb_lru_scan_depth
Specifies, per buffer pool instance, how far down the buffer pool LRU list the page cleaner thread scans looking for dirty pages to flush. This is a background operation performed once per second.
指定每个缓冲池实例,缓冲池LRU列表中页面cleaner线程扫描的位置,以查找要刷新的脏页。 这是每秒执行一次的后台操作。These options primarily help write-intensive workloads. With heavy DML activity, flushing can fall behind if it is not aggressive enough, resulting in excessive memory use in the buffer pool; or, disk writes due to flushing can saturate your I/O capacity if that mechanism is too aggressive. The ideal settings depend on your workload, data access patterns, and storage configuration (for example, whether data is stored on HDD or SSD devices).
这些选项主要有助于编写密集型工作负载。 如果DML活动繁重,如果刷新不够积极可能就会落后,导致缓冲池中的内存使用过多; 或者,如果这种机制过于激进,由于刷新导致的磁盘写操作可能会使I/O容量饱和。理想的设置取决于您的工作负载,数据访问模式和存储配置(例如,数据是存储在HDD还是SSD设备上)。
For systems with constant heavy workloads, or workloads that fluctuate widely, several configuration options let you fine-tune the flushing behavior for InnoDB tables:
对于具有持续繁重工作负载或频繁波动的工作负载的系统,可以使用多个配置选项来微调InnoDB表的刷新行为:
innodb_adaptive_flushing_lwm
innodb_max_dirty_pages_pct_lwm
innodb_io_capacity_max
innodb_flushing_avg_loops
These options feed into the formula used by the innodb_adaptive_flushing option.
这些选项可用于innodb_adaptive_flushing选项使用的公式。
The innodb_adaptive_flushing, innodb_io_capacity and innodb_max_dirty_pages_pct options are limited or extended by the following options:
innodb_adaptive_flushing,innodb_io_capacity和innodb_max_dirty_pages_pct选项受以下选项的限制或扩展:
innodb_adaptive_flushing_lwm
innodb_io_capacity_max
innodb_max_dirty_pages_pct_lwm
The InnoDB adaptive flushing mechanism is not appropriate in all cases. It gives the most benefit when the redo log is in danger of filling up. The innodb_adaptive_flushing_lwm option specifies a “low water mark” percentage of redo log capacity; when that threshold is crossed, InnoDB turns on adaptive flushing even if not specified by the innodb_adaptive_flushing option.
InnoDB adaptive flushing 机制并不适用于所有情况。 当重做日志有被填满的危险时,它提供了最大的好处。innodb_adaptive_flushing_lwm选项指定重做日志容量的“低水位”百分比; 当超过该阈值时,即使未由innodb_adaptive_flushing选项指定,InnoDB也会启用自适应刷新。
If flushing activity falls far behind, InnoDB can flush more aggressively than specified by innodb_io_capacity.innodb_io_capacity_max represents an upper limit on the I/O capacity used in such emergency situations, so that the spike in I/O does not consume all the capacity of the server.
如果刷新活动远远落后,InnoDB可以比innodb_io_capacity指定的更积极地进行刷新。innodb_io_capacity_max表示此类紧急情况下使用的I/O容量的上限,这样I/O峰值不会消耗服务器的所有容量。
InnoDB tries to flush data from the buffer pool so that the percentage of dirty pages does not exceed the value ofinnodb_max_dirty_pages_pct. The default value for innodb_max_dirty_pages_pct is 75.
InnoDB会尝试刷新缓冲池中的数据,以使脏页面的百分比不超过innodb_max_dirty_pages_pct的值。 innodb_max_dirty_pages_pct的默认值是75。
Note
The innodb_max_dirty_pages_pct setting establishes a target for flushing activity. It does not affect the rate of flushing. For information about managing the rate of flushing, see Section 14.6.3.6, “Configuring InnoDB Buffer Pool Flushing”.
innodb_max_dirty_pages_pct设置为flushing活动建立目标。 它不会影响刷新的速度。 有关管理刷新速率的信息,请参见第14.6.3.6节“配置InnoDB缓冲池刷新”。
The innodb_max_dirty_pages_pct_lwm option specifies a “low water mark” value that represents the percentage of dirty pages where pre-flushing is enabled to control the dirty page ratio and ideally prevent the percentage of dirty pages from reaching innodb_max_dirty_pages_pct. A value of innodb_max_dirty_pages_pct_lwm=0 disables the “pre-flushing”behavior.
innodb_max_dirty_pages_pct_lwm选项指定一个“低水位”值,该值表示启用预刷新以控制脏页比率的脏页百分比,理想情况下防止脏页百分比达到innodb_max_dirty_pages_pct。,innodb_max_dirty_pages_pct_lwm = 0的值会禁用“pre-flushing”行为。
Most of the options referenced above are most applicable to servers that run write-heavy workloads for long periods of time and have little reduced load time to catch up with changes waiting to be written to disk.
上面提到的大多数选项最适用于长时间运行写入繁重工作负载的服务器,并且几乎没有减少加载时间以赶上等待写入磁盘的更改。
innodb_flushing_avg_loops defines the number of iterations for which InnoDB keeps the previously calculated snapshot of the flushing state, which controls how quickly adaptive flushing responds to foreground load changes. Setting a high value for innodb_flushing_avg_loops means that InnoDB keeps the previously calculated snapshot longer, so adaptive flushing responds more slowly. A high value also reduces positive feedback between foreground and background work, but when setting a high value it is important to ensure that InnoDB redo log utilization does not reach 75% (the hardcoded limit at which async flushing starts) and that the innodb_max_dirty_pages_pct setting keeps the number of dirty pages to a level that is appropriate for the workload.
innodb_flushing_avg_loops定义了InnoDB保留之前计算的刷新状态快照的迭代次数,它控制了自适应刷新对前台负载变化的响应速度。。为innodb_flushing_avg_loops设置一个较高的值意味着InnoDB保持之前计算的快照时间更长,所以自适应刷新响应速度更慢。较高的值也会减少前台和后台工作之间的正反馈,但设置较高值时,确保InnoDB重做日志利用率未达到75%(异步刷新开始的硬编码限制)并且innodb_max_dirty_pages_pct设置保持不变 将脏页面数量设置为适合工作负载的级别。
Systems with consistent workloads, a large innodb_log_file_size, and small spikes that do not reach 75% redo log space utilization should use a high innodb_flushing_avg_loops value to keep flushing as smooth as possible. For systems with extreme load spikes or log files that do not provide a lot of space, consider a smaller innodb_flushing_avg_loops value. A smaller value allows flushing to closely track the load and helps avoid reaching 75% redo log space utilization.
具有一致工作负载,大型innodb_log_file_size以及未达到75%重做日志空间利用率的小型峰值的系统应该使用高innodb_flushing_avg_loops值来保持尽可能平滑的刷新.对于极端负载峰值或日志文件不足以提供大量空间的系统,请考虑使用较小的innodb_flushing_avg_loops值。较小的值允许刷新以密切跟踪负载,并有助于避免达到75%的重做日志空间利用率。
PREV: 14.6.3.6 Configuring InnoDB Buffer Pool Flushing. https://blog.51cto.com/itzhoujun/2355882
NEXT: 14.6.3.8 Saving and Restoring the Buffer Pool Stat https://blog.51cto.com/itzhoujun/2356988
标签:14.6,tuning,Buffer,max,innodb,dirty,flushing,InnoDB,pages 来源: https://blog.51cto.com/itzhoujun/2356985