简体   繁体   English

MySQL 如何从缓冲池中逐出页面?

[英]How does MySQL evict pages from the buffer pool?

I am trying to understand the internals of MySQL.我试图了解 MySQL 的内部结构。 I do know that MySQL's buffer pool management has an old/young page list as showshere .我知道,MySQL的缓冲池管理有一个老/年轻页面列表,显示在这里 And I do know about the flushing of old dirty pages, such as explained here and how to customize it here .而且我确实了解旧脏页的刷新,例如在此处解释以及如何在此处进行自定义。 I am also aware that MySQL uses a LRU algorithm for page eviction ashere .我也知道,MySQL使用的页收回一个LRU算法是在这里

However, is there a buffer pool daemon/thread that evicts read only pages (not dirty pages) that were brought to the buffer pool by say a select statement?但是,是否有一个缓冲池守护进程/线程可以驱逐通过 select 语句进入缓冲池的只读页面(而不是脏页面)? Are there ways to customize it (for example, when I pass 95% of the bufferpool capacity, start evicting read pages or flush dirty pages).是否有自定义它的方法(例如,当我通过 95% 的缓冲池容​​量时,开始驱逐读取页面或刷新脏页面)。 In other words, what triggers in the LRU algorithm evict pages from the buffer pool (eg time a page is on buffer pool, percentage of buffer pool filled, need to evict pages for new pages to load), are these adjustable?换句话说,LRU 算法中的哪些触发器从缓冲池中驱逐页面(例如,页面在缓冲池中的时间、缓冲池已填充的百分比、需要驱逐页面以加载新页面),这些是否可调整?

Flushing and evicting are entirely different.冲洗和驱逐是完全不同的。

https://dev.mysql.com/doc/refman/5.5/en/glossary.html#glos_flush https://dev.mysql.com/doc/refman/5.5/en/glossary.html#glos_flush

MySQL will flush dirty pages in accordance with innodb_max_dirty_pages_pct. MySQL会根据innodb_max_dirty_pages_pct刷新脏页。 The default database page size default in InnoDB is 16KB and the maximum setting for innodb_max_dirty_pages_pct is 99 so there isn't a whole lot of tolerance for the build up of dirty pages (although, as you know from the link you cite the actual flushing schedule calculation is a bit more complicated). InnoDB 中的默认数据库页面大小默认为 16KB,innodb_max_dirty_pages_pct 的最大设置为 99,因此对于脏页面的构建没有太多的容忍度(尽管,正如您从链接中知道的,您引用了实际的刷新计划计算有点复杂)。

After they are flushed they will then be evicted when they are the LRU.在它们被刷新后,当它们是 LRU 时,它们将被驱逐。

MySQL uses LRU with a "midpoint insertion strategy" approach. MySQL 使用带有“中点插入策略”方法的 LRU。 https://dev.mysql.com/doc/refman/5.5/en/glossary.html#glos_midpoint_insertion_strategy https://dev.mysql.com/doc/refman/5.5/en/glossary.html#glos_midpoint_insertion_strategy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM