Innodb存儲(chǔ)引擎中的后臺(tái)線程詳解
1.maste thread
負(fù)責(zé)將緩沖池中的數(shù)據(jù)異步刷新到磁盤,保證數(shù)據(jù)的一致性。
2.IO Thread
負(fù)責(zé)IO請(qǐng)求的回調(diào)處理。
1.0版本之前有4個(gè)IO Thread,負(fù)責(zé)write、read、insert buffer和log IO Thread
1.0.x開始,read thread和write thread分別增加到4個(gè),不再使用innodb_file_io_threads參數(shù),而是使用innodb_read_io_threads和innodb_write_io_threads
mysql> show variables like 'innodb_version'\G
*************************** 1. row ***************************
Variable_name: innodb_version
Value: 5.6.25
1 row in set (0.00 sec)
mysql> show variables like 'innodb_%io_threads'\G
*************************** 1. row ***************************
Variable_name: innodb_read_io_threads
Value: 4
*************************** 2. row ***************************
Variable_name: innodb_write_io_threads
Value: 4
2 rows in set (0.00 sec)
mysql> show engine innodb status\G
*************************** 1. row ***************************
Type: InnoDB
Name:
Status:
=====================================
2015-12-20 21:53:50 7fcaccfe8700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 11 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 93 srv_active, 0 srv_shutdown, 26243 srv_idle
srv_master_thread log flush and writes: 26336
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 393
OS WAIT ARRAY INFO: signal count 347
Mutex spin waits 297, rounds 8910, OS waits 281
RW-shared spins 53, rounds 1590, OS waits 50
RW-excl spins 13, rounds 1860, OS waits 57
Spin rounds per wait: 30.00 mutex, 30.00 RW-shared, 143.08 RW-excl
------------
TRANSACTIONS
------------
Trx id counter 2545
Purge done for trx's n:o < 2540 undo n:o < 0 state: running but idle
History list length 22
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 0, not started
MySQL thread id 5, OS thread handle 0x7fcaccfe8700, query id 491 localhost root init
show engine innodb 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
915 OS file reads, 1496 OS file writes, 1089 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 0, seg size 2, 0 merges
merged operations:
insert 0, delete mark 0, delete 0
discarded operations:
insert 0, delete mark 0, delete 0
Hash table size 276671, node heap has 2 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 369664448
Log flushed up to 369664448
Pages flushed up to 369664448
Last checkpoint at 369664448
0 pending log writes, 0 pending chkp writes
356 log i/o's done, 0.00 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total memory allocated 137363456; in additional pool allocated 0
Dictionary memory allocated 96365
Buffer pool size 8191
Free buffers 53
Database pages 8136
Old database pages 2983
Modified db pages 0
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 9747, not young 4864716
0.00 youngs/s, 0.00 non-youngs/s
Pages read 4212, created 12449, written 13322
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 8136, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Main thread process no. 2345, id 140508950664960, state: sleeping
Number of rows inserted 3919015, updated 0, deleted 0, read 8532141
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================
1 row in set (0.00 sec)
mysql>3.purge thread
事務(wù)提交后,purge thread線程回收已經(jīng)分配并被使用的undo頁。
innodb 1.2開始,支持多個(gè)purge thread。
purge thread離散地讀取undo頁。
mysql> show variables like 'innodb_purge_threads'; +----------------------+-------+ | Variable_name | Value | +----------------------+-------+ | innodb_purge_threads | 1 | +----------------------+-------+ 1 row in set (0.00 sec) mysql>
4.page cleaner thread
1.2.x版本中引入的。將之前版本中臟頁的刷新操作都放入到單獨(dú)的線程中來完成。減輕master thread的工作。
總結(jié)
到此這篇關(guān)于Innodb存儲(chǔ)引擎中后臺(tái)線程的文章就介紹到這了,更多相關(guān)Innodb后臺(tái)線程內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
MySQL窗口函數(shù)實(shí)現(xiàn)榜單排名
相信大家在日常的開發(fā)中經(jīng)常會(huì)碰到榜單類的活動(dòng)需求,本文主要介紹了MySQL窗口函數(shù)實(shí)現(xiàn)榜單排名,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2023-04-04
解決 phpmyadmin #2002 無法登錄 MySQL 服務(wù)器
我以前使用phpmyadmin都是很正常的,從來沒有出現(xiàn)過問題。但是今天出現(xiàn)了提示#2002無法登陸到MYSQL服務(wù)器2012-04-04
mysql格式化小數(shù)保留小數(shù)點(diǎn)后兩位(小數(shù)點(diǎn)格式化)
今天遇到一個(gè)問題,格式化浮點(diǎn)數(shù)的問題,用format(col,2)保留兩位小數(shù)點(diǎn),出現(xiàn)一個(gè)問題,例如下面的語句,后面我們給出解決方法2013-12-12
Windows?Server?2019?MySQL數(shù)據(jù)庫的安裝與配置理論+遠(yuǎn)程連接篇
mysql是一款關(guān)系型數(shù)據(jù)庫管理系統(tǒng),由MySQL?AB公司開發(fā),目前屬于Oracle旗下產(chǎn)品,MySQL是最流行的關(guān)系型數(shù)據(jù)庫管理系統(tǒng)之一。MySQL也是一款開源的SQL數(shù)據(jù)庫管理系統(tǒng),是眾多小型網(wǎng)站作為網(wǎng)站數(shù)據(jù)庫的首選數(shù)據(jù)庫2023-05-05
基于Mysql+JavaSwing的超市商品管理系統(tǒng)設(shè)計(jì)與實(shí)現(xiàn)
本項(xiàng)目是使用Java swing開發(fā),可實(shí)現(xiàn)超市管理系統(tǒng)商品列表信息查詢、添加商品信息和修改商品管理以及刪除商品信息和安裝商品信息查詢等功能。界面設(shè)計(jì)和功能比較簡單基礎(chǔ)、適合作為Java課設(shè)設(shè)計(jì)以及學(xué)習(xí)技術(shù)使用,需要的朋友可以參考一下2021-09-09

