mysql 内存说明

登录mysql数据库查看内存
mysql> select event_name,current_alloc from sys.memory_global_by_current_bytes limit 10;
+--------------------------------------------------------------------+---------------+
| event_name | current_alloc |
+--------------------------------------------------------------------+---------------+
| memory/innodb/buf_buf_pool | 4.09 GiB |
| memory/innodb/hash0hash | 114.91 MiB |
| memory/sql/TABLE_SHARE::mem_root | 114.68 MiB |
| memory/sql/TABLE | 75.82 MiB |
| memory/temptable/physical_ram | 73.00 MiB |
| memory/innodb/memory | 67.51 MiB |
| memory/innodb/ut0new | 64.08 MiB |
| memory/mysys/IO_CACHE | 60.98 MiB |
| memory/performance_schema/events_statements_summary_by_digest | 39.67 MiB |
| memory/performance_schema/events_errors_summary_by_thread_by_error | 36.27 MiB |
+--------------------------------------------------------------------+---------------+
10 rows in set (0.00 sec)mysql

mysql> sql

mysql> select host,current_allocated from sys.memory_by_host_by_current_bytes;
+---------------+-------------------+
| host | current_allocated |
+---------------+-------------------+
| xx.xx.xx.xx | 183.54 GiB |
| 127.0.0.1 | 16.29 GiB |
| localhost | 70.63 MiB |
| background | -183.39 GiB |
+---------------+-------------------+
10 rows in set (0.02 sec)数据库

#free -m
total used free shared buff/cache available
Mem: 7783 5624 63 522 2095 1503
Swap: 16379 2 16377ide

我物理内存8G,你咋还查出来183.54GiB,只能说mysql在内存方面的监控很烂啊,但愿之后有所改进,仍是经过操做系统命令top来看比较准一些。
以下图:
mysql 内存说明
看VIRT和RES便可,若是和你配置的数据库buffer差很少,就不存在内存泄漏。咱们若是想看在某个时间点哪一个SQL占用了多少内存这个目前还作不到啊 。内存不够该扩容就扩容,就这么简单。操作系统

相关文章
相关标签/搜索