mysql结构化显示表,工具:结构化输出innodb status

1). 平均值(采样间隔)

输出内容包含了一些平均值的统计信息,例如fsync()每秒调用次数。这些平均值是自上次输出结果生成以来的统计数。因此如果正在检查这些值,要确保已经等待了30s左右的时间,使两次采样之间积累足够长的时间并多次采样,检查计数器变化从而弄清其行为。并不是所有的输出都会在一个时间点上生成,因而也不是所有显示出来的平均值会在同一时间间隔里重新计算一遍。而且,InnoDB有一个内部复位间隔,而它是不可预知的,各个版本不一样。

2). 查看方式Innotop

可查看部分信息,但是基于Perl产品,过于古老了。命令行

下面方式可显示指定栏目,并用颜色标注栏目标题,但仅仅是查看方便,不会解析内容。

mysql -uroot -e "show engine innodb status\G"|grep -E -A4 -B1 --color '^TRANSACTIONS|LOG|ROW OPERATIONS'数据字典

例如INNODB_BUFFER_POOL_STATS,但只有部分内容。

★正是基于上面原因,考虑自己写个脚本解析输出。

2. InnoDB Status输出解读(5.7)1). 头部信息

输出的第一段是头部信息,它仅仅是代表输出的开始,其内容包括当前的日期和时间,以及自上次输出以来经过的时长。

2). SEMAPHORE

这部分主要显示系统中当前的信号等待信息及各种等待信号的统计信息,这部分信息对于调整innodb_thread_concurrency参数有帮助。当等待信号量非常大的时候,可能就需要禁用并发线程检测设置innodb_thread_concurrency=0。如果是高并发的工作环境,需要关注这一段信号量。它包含了两种数据:时间计数器,以及可选的当前等待线程的列表。如果有性能瓶颈,可用这些信息来帮你找到瓶颈所在。

3). LATEST FOREIGN KEY ERROR

一般不会出现这个信息,除非在服务器上发生一个外键错误。

4). LATEST DETECTED DEADLOCK

只有在服务器内有死锁发生才会出现。

5). TRANSACTION

InnoDB事务的摘要信息。显示系统的锁等待信息和当前活动事务信息。通过这部分,可以追踪到死锁的详细信息。

6). FILE I/O

FILE I/O段显示的是I/O helper线程的状态,用性能计数器的方式来表示。文件IO相关信息,主要是IO等待信息。

7). INSERT BUFFER AND ADAPTIVE HASH INDEX

显示插入缓存当前状态信息及自适应Hash Index的状态。

8). LOG

显示的InnoDB事务LOG子系统的统计信息。InnoDB事务日志相关信息,包括当前的日志序列号(log sequence number),已经刷新同步到哪个序列号,最近的Check Point到哪个序列号。除此之外,还显示了系统从启动到现在已经做了多少次Check Point,多少次日志刷新。

9). BUFFER POOL AND MEMORY

显示InnoDB Buffer Pool相关的各种统计信息,以及其他一些内存使用的信息。

10). ROW OPERATIONS

显示的是与客户端的请求Query和Query所影响的记录统计信息。3. 部分指标说明(5.7)Total memory allocated

The total memory allocated for the buffer pool in bytes.Dictionary memory allocated

The total memory allocated for the InnoDB data dictionary in bytes.Buffer pool size

The total size in pages allocated to the buffer pool.Free buffers

The total size in pages of the buffer pool free list.Database pages

The total size in pages of the buffer pool LRU list.

Old database pages

The total size in pages of the buffer pool old LRU sublist.

Modified db pages

The current number of pages modified in the buffer pool.

Pending reads

The number of buffer pool pages waiting to be read in to the buffer pool.

Pending writes LRU

The number of old dirty pages within the buffer pool to be written from the bottom of the LRU list.

Pending writes flush list

The number of buffer pool pages to be flushed during checkpointing.

Pending writes single page

The number of pending independent page writes within the buffer pool.

Pages made young

The total number of pages made young in the buffer pool LRU list (moved to the head of sublist of "new" pages).

Pages made not young

The total number of pages not made young in the buffer pool LRU list (pages that have remained in the "old" sublist without being made young).

youngs/s

The per second average of accesses to old pages in the buffer pool LRU list that have resulted in making pages young.

non-youngs/s

The per second average of accesses to old pages in the buffer pool LRU list that have resulted in not making pages young.

Pages read

The total number of pages read from the buffer pool.

Pages created

The total number of pages created within the buffer pool.

Pages written

The total number of pages written from the buffer pool.

reads/s

The per second average number of buffer pool page reads per second.

creates/s

The per second average number of buffer pool pages created per second.

writes/s

The per second average number of buffer pool page writes per second.

Buffer pool hit rate

The buffer pool page hit rate for pages read from the buffer pool memory vs from disk storage.

young-making rate

The average hit rate at which page accesses have resulted in making pages young.

not (young-making rate)

The average hit rate at which page accesses have not resulted in making pages young.

Pages read ahead

The per second average of read ahead operations.

Pages evicted without access

The per second average of the pages evicted without being accessed from the buffer pool.

Random read ahead

The per second average of random read ahead operations.

LRU len

The total size in pages of the buffer pool LRU list.

unzip_LRU len

The total size in pages of the buffer pool unzip_LRU list.

I/O sum

The total number of buffer pool LRU list pages accessed, for the last 50 seconds.

I/O cur

The total number of buffer pool LRU list pages accessed.

I/O unzip sum

The total number of buffer pool unzip_LRU list pages accessed.

I/O unzip cur

The total number of buffer pool unzip_LRU list pages accessed.

4.脚本说明1). 准备条件模块 - MySQLDB

Python版本 >= 2.6.x (3.x版本不支持)

2). 使用方法

Usage:

./mysql_innodb_status.py

-h : database ip address/domain name

-u : username

-p : password

-k : print specified items(section.key1,section.key2) or section.*

-n : interval time

-w : width

3). 使用示例

python mysql_innodb_status.py

-h localhost -u testuser -p testpwd

-k all -n 5

python mysql_innodb_status.py

-h localhost -u testuser -p testpwd

-k row_operations.* -n 5

python mysql_innodb_status.py

-h localhost -u testuser -p testpwd

-k row_operations.reads_per_second -n 50

4). 源码地址

https://github.com/bjbean/parse-mysql-innodb-status/blob/master/show-innodb-status-v2.py

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值