首页 » MySQL » MySQL8 ‘show engine innodb status’ 显示 “Total large memory allocated 0”

MySQL8 ‘show engine innodb status’ 显示 “Total large memory allocated 0”

MySQL 中也有像oracle v$sysstat简化的实时监控InnoDB表内部计数器, MySQL 8.0.31 最新版有310多个计数器, 使用show engine innodb status可以查看,但可读性并不好,有些版本显示内存总扩展为0错误。这个问题影响>= 8.0.27.

----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 0
Dictionary memory allocated 412002

原因
这是Bug 33748316 – “Total large memory allocated 0”.在是8.0.27修复Bug #33159210 引入的新bug.

解决方法
查询performance_schema 表 memory usage of InnoDB

SELECT SUM(CURRENT_NUMBER_OF_BYTES_USED) from performance_schema.memory_summary_global_by_event_name e where event_name like 'memory/innodb/%';

另外MySQL 本身还有一张表,在元数据字典库里innodb_metrics。注意该表的size以PAGE为单位(16KB),Show engine innodb status 结果相关计数器在表innodb_metrics里默认开启,字段status的值为enabled。为了避免对MySQL的性能造成影响,还有200多个计数器开关默认是关闭的。

开启这些计数器:通过变量 innodb_monitor_enable 开启。

[mysql:8.0.31:information_schema>]set global innodb_monitor_enable='cpu_n'; -- 总CPU核数。
Query OK, 0 rows affected (0.00 sec)

[mysql:8.0.31:information_schema>]select name,max_count,comment, status from innodb_metrics where name in ('cpu_n');
+---------------+-----------+-----------------------------+---------+
| name          | max_count | comment                     | status  |
+---------------+-----------+-----------------------------+---------+
| cpu_utime_abs |       128 | Total CPU user time spent   | enabled |

通过变量innodb_monitor_disable随时关闭这些计数器:

[information_schema]set global innodb_monitor_disable='cpu_n';
Query OK, 0 rows affected (0.00 sec)

打赏

对不起,这篇文章暂时关闭评论。