Ⅰ味赃、看下所有后臺線程
(root@localhost) [(none)]> select name from performance_schema.threads where name like 'thread/innodb%' order by name;
+----------------------------------------+
| name |
+----------------------------------------+
| thread/innodb/buf_dump_thread | # dump bp
| thread/innodb/dict_stats_thread | # 元數(shù)據(jù)
| thread/innodb/io_ibuf_thread | # change buffer
| thread/innodb/io_log_thread | # 寫重做日志
| thread/innodb/io_read_thread | # 異步讀
| thread/innodb/io_read_thread |
| thread/innodb/io_read_thread |
| thread/innodb/io_read_thread |
| thread/innodb/io_write_thread | # 異步寫
| thread/innodb/io_write_thread |
| thread/innodb/io_write_thread |
| thread/innodb/io_write_thread |
| thread/innodb/page_cleaner_thread | # 刷新臟頁苦银,innodb_page_cleaners葛碧,建議和io_write_thread設(shè)置一樣
| thread/innodb/srv_error_monitor_thread | # 監(jiān)控
| thread/innodb/srv_lock_timeout_thread | # 監(jiān)控
| thread/innodb/srv_master_thread | # 之前很關(guān)鍵蒜哀,臟頁刷新之前在這個線程里罗心,5.6開始移出去了,基本上現(xiàn)在就是刷新重做日志的
| thread/innodb/srv_monitor_thread | # 監(jiān)控
| thread/innodb/srv_purge_thread | # 回收undo
| thread/innodb/srv_worker_thread | # page_cleaner的子線程
| thread/innodb/srv_worker_thread |
| thread/innodb/srv_worker_thread |
+----------------------------------------+
21 rows in set (0.00 sec)
異步讀寫由下面兩個參數(shù)控制
innodb_read_io_threads 不建議調(diào)整含思,讀取基本上很少是異步崎弃,調(diào)大沒太大意義
innodb_write_io_threads 可以調(diào)大一點,因為數(shù)據(jù)庫寫入都是異步的含潘,默認是4饲做,調(diào)成8或者16,特別是ssd的情況下
Ⅱ遏弱、臟頁刷新
innodb_io_capacity參數(shù)控制
每十秒鐘刷新這個參數(shù)個頁盆均,這是一個全量的刷新,如果量特別大也可能是每秒鐘刷這么多漱逸,可以理解為每秒鐘刷的最多的量
innodb_io_capacity_max 5.7中出來的參數(shù)作額外控制泪姨,一般設(shè)為前者的double
這里先了解即可游沿,如需深入,需要展開master thread的工作原理肮砾,請參考《MySQL技術(shù)內(nèi)幕——InnoDB存儲引擎》第2版