标签:stat 如何 线程 kill 用户线程 产生 hat 修改 用户
mysql> show global status like ‘i%read%‘;
| Innodb_buffer_pool_reads | 647 |
| Innodb_data_read | 48402944 |
| Innodb_data_reads | 2996 |
| Innodb_pages_read | 2949 |
| Innodb_rows_read | 1002172 |
mysql> show engine innodb status \G
---
LOG
---
Log sequence number 144064129 //已经生成的日志量(累计值)/单位:字节
Log flushed up to 144064129 //已经写入的日志量(累计值)
Pages flushed up to 144064129 //已经写入的脏页量(累计值)
Last checkpoint at 144064120 //检查点
0 pending log flushes, 0 pending chkp writes
92 log i/o‘s done, 0.00 log i/o‘s/second
mysql> show status like ‘Sort_merge_passes‘;
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Sort_merge_passes | 0 |
+-------------------+-------+
1 row in set (0.00 sec)
用户所需数据,如果没有内存buffer pool中,就发生物理读;
如果需要过滤掉很多数据,就会影响物理读和内存读,因为返回很多的数据(物理读),在内存中需要过滤掉很多数据(内存读);
如果涉及到group/order by,会在用户工作空间完成排序等,如果结果集过大,用户空间过小,进行磁盘排序,Sort_merge_passes>0 ,这就很影响数据库性能了。
mysql> show engine innodb status \G
--------
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)
mysql> show variables like ‘innodb_read_io_threads‘;
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| innodb_read_io_threads | 4 |
+------------------------+-------+
1 row in set (0.01 sec)
mysql> show variables like ‘innodb_write_io_threads‘;
+-------------------------+-------+
| Variable_name | Value |
+-------------------------+-------+
| innodb_write_io_threads | 4 |
+-------------------------+-------+
1 row in set (0.01 sec)
关于innodb_purge_threads:page cleaner 线程
作用:1、负责对 undo 数据页的清空
2、数据页中 delete 标志行的清除
3、清理 innodb buffer pool,负责把内存中的脏页发起写请求,write 线程负载把脏页刷新到磁盘上。
mysql> show global status like ‘Innodb_log_waits‘;
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| Innodb_log_waits | 0 |
+------------------+-------+
1 row in set (0.00 sec)
如果log buffer太小,就很容易满,导致无法写入,产生日志等待。
mysql> show global status like ‘Innodb_os_log_written‘; #redo log写的字节数
+-----------------------+-------+
| Variable_name | Value |
+-----------------------+-------+
| Innodb_os_log_written | 57856 |
+-----------------------+-------+
1 row in set (0.01 sec)
mysql> show global status like ‘Innodb_log_writes‘;
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Innodb_log_writes | 59 |
+-------------------+-------+
1 row in set (0.01 sec)
mysql> show engine innodb status \G
Pending flushes (fsync) log: 0;
mysql> show global status like ‘Innodb_os_log_pending_fsyncs‘; +------------------------------+-------+ | Variable_name | Value | +------------------------------+-------+ | Innodb_os_log_pending_fsyncs | 0 | +------------------------------+-------+ 1 row in set (0.00 sec)
mysql> show variables like "%log_buffer%"; +------------------------+----------+ | Variable_name | Value | +------------------------+----------+ | innodb_log_buffer_size | 16777216 | +------------------------+----------+
标签:stat 如何 线程 kill 用户线程 产生 hat 修改 用户
原文地址:https://www.cnblogs.com/DataArt/p/10182551.html