Innodb存储引擎的后台线程:
① I/O thread
② master thread
③ 锁监控线程
④ 错误监控线程
内存
① 缓冲池 :所占的内存最大,innodb存储引擎的工作方式是将数据库文件按页读取到缓冲池,使用最近最少使用算法保留缓冲池中的数据。当数据发生改变时(uodate、delete等),总是先修改缓冲池中的页(修改后即为脏页),然后按照一定的频率将脏页刷新到数据库文件中。
② 重做日志缓冲池:将重做日志信息先放入到缓冲池,然后按照一定的频率刷新到重做日志文件
③ 额外的内存池
master thread
① 主循环(loop)
② 后台循环(background loop )
③ 刷新循环(flush loop)
④ 暂停循环(pause loop)
show engine innodb status(显示过去某个时间范围内innodb存储引擎的状态)
=====================================
2018-12-14 16:49:11 0x7f11abf9d700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 33 seconds(过去33秒内的数据库状态)
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 3241 srv_active, 0 srv_shutdown, 207111 srv_idle(主循环执行了3241 次)
srv_master_thread log flush and writes: 210277
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 40852
OS WAIT ARRAY INFO: signal count 42651
RW-shared spins 0, rounds 65292, OS waits 17300
RW-excl spins 0, rounds 478088, OS waits 8460
RW-sx spins 9936, rounds 254663, OS waits 6194
Spin rounds per wait: 65292.00 RW-shared, 478088.00 RW-excl, 25.63 RW-sx
------------
TRANSACTIONS
------------
Trx id counter 978080
Purge done for trx's n:o < 978077 undo n:o < 0 state: running but idle
History list length 8
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421190993835872, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
--------
FILE I/O(10个I/IO thread:4个wirte ,4个read,1个log,1个insert)
--------
I/O thread 0 state: waiting for completed aio requests (insert buffer thread)
I/O thread 1 state: waiting for completed aio requests (log thread)
I/O thread 2 state: waiting for completed aio requests (read thread)
I/O thread 3 state: waiting for completed aio requests (read thread)
I/O thread 4 state: waiting for completed aio requests (read thread)
I/O thread 5 state: waiting for completed aio requests (read thread)
I/O thread 6 state: waiting for completed aio requests (write thread)
I/O thread 7 state: waiting for completed aio requests (write thread)
I/O thread 8 state: waiting for completed aio requests (write thread)
I/O thread 9 state: waiting for completed aio requests (write thread)
Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
ibuf aio reads:, log i/o's:, sync i/o's:
Pending flushes (fsync) log: 0; buffer pool: 0
1159878 OS file reads, 334621 OS file writes, 109906 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 3071, seg size 3073, 25141 merges( seg size 插入缓冲的大小 3073* 16k = 48MB)(free list len代表空闲列表的长度)()
merged operations:
insert 51877, delete mark 116423, delete 3472
discarded operations:
insert 0, delete mark 0, delete 0
Hash table size 34679, node heap has 87 buffer(s)
Hash table size 34679, node heap has 1 buffer(s)
Hash table size 34679, node heap has 1 buffer(s)
Hash table size 34679, node heap has 1 buffer(s)
Hash table size 34679, node heap has 1 buffer(s)
Hash table size 34679, node heap has 145 buffer(s)
Hash table size 34679, node heap has 1 buffer(s)
Hash table size 34679, node heap has 1 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 7683841890
Log flushed up to 7683841890
Pages flushed up to 7683841890
Last checkpoint at 7683841881
0 pending log flushes, 0 pending chkp writes
89700 log i/o's done, 0.00 log i/o's/second
----------------------
BUFFER POOL AND MEMORY(缓冲池的使用情况)
----------------------
Total large memory allocated 137428992
Dictionary memory allocated 363121
Buffer pool size 8192(缓冲帧的个数,16K/个)8192*16/1024 = 128MB,缓冲池的大小是128MB
Free buffers 1016(当前空闲的缓冲帧个数)
Database pages 6938 (已经使用的缓冲帧)
Old database pages 2542
Modified db pages 0(脏页的数量)
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 20481724, not young 19318977
0.00 youngs/s, 0.00 non-youngs/s
Pages read 1159825, created 13211, written 235753
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: 6938, 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
Process ID=23821, Main thread ID=139715717015296, state: sleeping
Number of rows inserted 179128, updated 195, deleted 56184, read 7720771964
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================