时间:2021-07-01 10:21:17 帮助过:28人阅读
通过命令show engine innodb status来观察InnoDB中的IO hread:
mysql> show engine innodb status\G *************************** 1. row *************************** Type: InnoDB Name: Status: ===================================== 。。。。。。。 -------- FILE I/O -------- I/O thread 0 state: waiting for i/o request (insert buffer thread) I/O thread 1 state: waiting for i/o request (log thread) I/O thread 2 state: waiting for i/o request (read thread) I/O thread 3 state: waiting for i/o request (read thread) I/O thread 4 state: waiting for i/o request (read thread) I/O thread 5 state: waiting for i/o request (read thread) I/O thread 6 state: waiting for i/o request (write thread) I/O thread 7 state: waiting for i/o request (write thread) I/O thread 8 state: waiting for i/o request (write thread) I/O thread 9 state: waiting for i/o request (write thread) Pending normal aio reads: 0 [0, 0, 0, 0] , aio writes: 0 [0, 0, 0, 0] , ibuf aio reads: 0, log i/o‘s: 0, sync i/o‘s: 0 Pending flushes (fsync) log: 0; buffer pool: 0 425008825 OS file reads, 356489210 OS file writes, 265709650 OS fsyncs 0.05 reads/s, 16384 avg bytes/read, 100.60 writes/s, 62.48 fsyncs/s ------------------------------------- INSERT BUFFER AND ADAPTIVE HASH INDEX -------------------------------------
其中I/O thread 0 为 insert buffer thread。I/O thread 1 为 log thread 。后面就是根据参数innodb_read_io_threads 及 innodb_write_io_threads 来设置的读写线程。并且读线程的ID总是小于写线程ID。
3、Purge Thread
InnoDB 1.2版本 purge操作可以独立到单独线程进行,来减轻Master Thread的工作,提高CPU的使用率及提升存储引擎性能。还可以支持多个 Purge Thread.可以加快 undo页回收。同时 Purge Thread 需要离散地读取 undo 页,这样能更进一步利用磁盘的随机读取性能。
mysql> show variables like ‘innodb_purge%‘\G *************************** 1. row *************************** Variable_name: innodb_purge_batch_size Value: 300 *************************** 2. row *************************** Variable_name: innodb_purge_threads Value: 1 2 rows in set (0.01 sec)
其中参数 innodb_purge_threads 为开启的Purge Thread数量,innodb_purge_batch_size 为 设置每次purge清理的undo页数,如果值太大则会导致CPU和磁盘IO过于集中(参考:https://www.cnblogs.com/suolu/p/6634592.html)
4、Page Cleaner Thread
Page Cleaner Thread 是在InnoDB 1.2.x 版本中引入的,作用是将之前版本中脏页的刷新操作都放入到单独的线程中来完成。以减轻原Master Thread 的工作及对用户查询线程的阻塞,进一步提高 InnoDB 存储引擎的性能。
InnoDB后台线程
标签:通过命令 不同的 随机 flush 读写 *** file 情况下 val