欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Mysql InnoDB笔记内存_MySQL

程序员文章站 2024-02-14 23:17:10
...
bitsCN.com

Mysql InnoDB笔记内存

InnoDB 状态

Sql代码

show engine innodb status/G;

执行结果

Type: InnoDB

Name:

Status:

Per second averages calculated from the last 6 seconds

-----------------

BACKGROUND THREAD

-----------------

srv_master_thread loops: 0 srv_active, 0 srv_shutdown, 17509 srv_idle

srv_master_thread log flush and writes: 17509

----------

SEMAPHORES

----------

OS WAIT ARRAY INFO: reservation count 2

OS WAIT ARRAY INFO: signal count 2

Mutex spin waits 5, rounds 12, OS waits 0

RW-shared spins 2, rounds 60, OS waits 2

RW-excl spins 0, rounds 0, OS waits 0

Spin rounds per wait: 2.40 mutex, 30.00 RW-shared, 0.00 RW-excl

------------

TRANSACTIONS

------------

Trx id counter 17154

Purge done for trx's n:o

History list length 588

LIST OF TRANSACTIONS FOR EACH SESSION:

---TRANSACTION 0, not started

MySQL thread id 1, OS thread handle 0x8ac, query id 15 localhost 127.0.0.1 root

init

show engine innodb status

--------

FILE I/O

--------

I/O thread 0 state: wait Windows aio (insert buffer thread)

I/O thread 1 state: wait Windows aio (log thread)

I/O thread 2 state: wait Windows aio (read thread)

I/O thread 3 state: wait Windows aio (read thread)

I/O thread 4 state: wait Windows aio (read thread)

I/O thread 5 state: wait Windows aio (read thread)

I/O thread 6 state: wait Windows aio (write thread)

I/O thread 7 state: wait Windows aio (write thread)

I/O thread 8 state: wait Windows aio (write thread)

I/O thread 9 state: wait Windows aio (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

312 OS file reads, 5 OS file writes, 5 OS fsyncs

0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s

-------------------------------------

INSERT BUFFER AND ADAPTIVE HASH INDEX 性能 插入缓冲与自适应哈希 插入缓冲不是缓冲池的一部分.它使用于索引是辅助索引,且索引不是唯一的.因为如主键自增长则插入这个聚集索引按顺序插入很快完成,但是如表另有不是唯一的非聚集索引,就需要对非聚集索引的叶子节点插入离散存储B+树.

-------------------------------------

Ibuf: size 1, free list len 0, seg size 2, 0 merges segSize:当前插入缓冲大小为2*16KB. free list 为空闲列表长度 size 为 已合并记录页为数量 insert 为插入记录数,merged 合并的页数量,merges合并次数

merged operations:

insert 0, delete mark 0, delete 0

discarded operations:

insert 0, delete mark 0, delete 0

Hash table size 553253, node heap has 1 buffer(s)

0.00 hash searches/s, 0.00 non-hash searches/s

---

LOG

---

Log sequence number 2122026419

Log flushed up to 2122026419

Pages flushed up to 2122026419

Last checkpoint at 2122026419

0 pending log writes, 0 pending chkp writes

8 log i/o's done, 0.00 log i/o's/second

----------------------

BUFFER POOL AND MEMORY

----------------------

Total memory allocated 135987200; in additional pool allocated 0

Dictionary memory allocated 32514

Buffer pool size 8192

Free buffers 7892

Database pages 299

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 299, created 0, written 1

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: 299, 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 id 2708, state: sleeping

Number of rows inserted 0, updated 0, deleted 0, read 0

0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s

----------------------------

END OF INNODB MONITOR OUTPUT

============================

InnoDB的内存

由缓冲池,重做日志缓冲池及额外的内存构成.

Sql代码

show variables like 'innodb_buffer_pool_size'/G; 134217728

show variables like 'innodb_log_buffer_size'/G; 8388608

show variables like 'innodb_additional_mem_pool_size'/G; 8388608

缓冲池是最大的部分,用来存放各种数据的缓存.引擎按页16KB/每页读取到缓冲池,然后按LRU保留缓冲池中的数据.如果数据库文件需要修改,先修改缓冲池中的页,修改后即为脏页,然后按一定的频率将脏页刷新到文件.

Buffer pool size 8192 中的大小即可算出缓冲区 8192*16(KB/page)/1024 =?

缓冲池中缓存的数据类型有:索引页,数据页,UNDO页,插入缓冲,自适应哈希索引,InnoDB锁信息,数据字典等.

AWE 开启后引擎自动禁用自适应哈希索引.

日志缓冲将重做日志信息先放入这个缓冲区,再按一定的频率将其刷新到重做日志文件.

bitsCN.com