5.7 of Performance_schema already have the ability to monitor the memory usage of MySQL, for this is to be achieved through the instrument, because the memory this piece does not have a corresponding consumer so long as
Well, it's okay to configure instrument.
1. Example:
/etc/my.cnf
[Mysqld]datadir =/usr/local/mysql/databasedir =/usr/local/mysqlperformance_schema_instrument =' memory%=counted'
SelectEvent_name,current_alloc fromSys.memory_global_by_current_bytes limitTen;+-----------------------------------------------------------------------------+---------------+|Event_Name|Current_alloc|+-----------------------------------------------------------------------------+---------------+|Memory/InnoDB/Buf_buf_pool| 131.06Mib||Memory/InnoDB/Log0log| 32.01Mib||Memory/Performance_schema/Events_statements_history_long| 13.66Mib||Memory/Performance_schema/Events_statements_history_long.sqltext| 9.77Mib||Memory/Performance_schema/Events_statements_history_long.tokens| 9.77Mib||Memory/Performance_schema/Events_statements_summary_by_digest.tokens| 9.77Mib||Memory/Performance_schema/Table_handles| 9.06Mib||Memory/Performance_schema/Events_statements_summary_by_thread_by_event_name| 8.67Mib||Memory/Mysys/Key_cache| 8.00Mib||Memory/Performance_schema/Memory_summary_by_thread_by_event_name| 5.62Mib|+-----------------------------------------------------------------------------+---------------+
MySQL 5.7 Memory usage monitoring