mysql内存的三个部分 pool buffer,additional pool buffer,log buffer
下边是缓冲区
mysql> show engine innodb status \G
*************************** 1. row ***************************
Type: InnoDB
Name:
Status:
=====================================
2017-11-18 11:06:52 0x70000ed48000 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 43 seconds
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 137428992
Dictionary memory allocated 290846
Buffer pool size 8192 --缓冲区 8192页 每页16k =下边的Free buffers +Database pages
Free buffers 7746 --空闲页
Database pages 446 --已经使用掉的缓冲区 分为2部分,新数据区和旧数据区(下边的Old database pages),
区别是前者是常访问的数据,后者是不常访问的数据
Old database pages 0 --旧数据区
Modified db pages 0 --脏页,已写入数据,但是没写入硬盘表空间
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 411, created 35, written 37
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: 446, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
Buffer pool size=空闲页(Free buffers)+数据页(Database pages)
每页16k
下边是插入缓存和自适应哈希
-------------------------------------
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 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
Hash table size 34679, node heap has 0 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
线程 分为后台线程 和io线程
后台线程
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 1 srv_active, 0 srv_shutdown, 387535 srv_idle
srv_master_thread log flush and writes: 387535
----------
io线程
--------
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] , 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
453 OS file reads, 54 OS file writes, 7 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
-------------------------------------
其中pool buffer 分为数据页(data page),插入缓存(insert buffer ),锁信息(log info) ,索引页(index page ),自适应哈希索引,数据字典信息
buffer poll分为三种page,free page ,clean page,dirty page
数据页按照每页16k,数据页发生修改后就是变成脏页,脏页按照一定的频率刷新(flush)到文件
每张表的表空间内存放的只是数据、索引和插入缓冲,其他类的数据,如撤销(Undo)信息、系统事务信息、二次写缓冲(double write buffer)等还是存放在原来的共享表空间内。
参考文献
https://www.cnblogs.com/jiangxu67/p/3765708.html
http://book.51cto.com/art/201402/429092.htm