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> 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 16377


我物理內存8G,你咋還查出來183.54GiB,只能說mysql在內存方面的監控很爛啊,希望以後有所改進,還是通過操作系統命令top來看比較準一些。
如下圖:
mysql 內存說明
看VIRT和RES即可,如果和你配置的數據庫buffer差不多,就不存在內存泄漏。我們如果想看在某個時間點哪個SQL佔用了多少內存這個目前還做不到啊 。內存不夠該擴容就擴容,就這麼簡單。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章