Innodb核心原理之后台线程

2024-09-09  本文已影响0人  这货不是王马勺

后台线程的主要作用

大致可以将线程分为如下四类

I/O thread

我们查看引擎状态:

show engine innodb status

在其中我们可以看到FILE I/O一个板块,其中可以看到10个I/O thread:

其中有insert buffer thread、log thread、read thread、write thread:

purge thread

在事务提交之后,其使用的undo日志就不需要了,purge thread会回收已经分配的undo页。

show variables like '%innodb_purge_thread%';

默认4,支持多个purge thread以加快回收undo页速度。

page cleaner thread

作用有两部分,一个是将脏页数据刷新到磁盘,另一个是脏数据刷盘之后,相应的redo log的覆盖。
既可以同步数据,又能达到redo log循环使用的目的。

show variables like '%innodb_page_cleaner%';

默认1,一个线程。

master thread

innodb主线程,作用是负责调度其他线程,优先级最高。

内部有两种操作方式,分别是每隔1秒处理,和每隔10秒处理。
每隔一秒

show variables like '%innodb_max_dirty%';

每隔十秒

相关参数

参考:

https://blog.csdn.net/qq_26664043/article/details/135821673
上一篇 下一篇

猜你喜欢

热点阅读