MySQL Memory Monitor

Source: Internet
Author: User

The previous blog describes a case where memory spikes due to SQL query Information_schema tables.

Today, by the way, a THD memory is monitored:

Let's introduce the memory of MySQL:

1. In-thread memory: thd->mem_root, during the execution of SQL, the requested memory is allocated from Thd->mem_root and released at the end of SQL.

2. Out-of-thread memory: Object-specific mem_root; For example, table, table_share,st_transactions, etc. all have proprietary mem_root.

So: For SQL-induced memory spikes, you can monitor thd->mem_root changes. For others, such as temporary tables created, additional monitoring is required.

Add a thd_size field to the function called by sql/sql_show.cc show Processlist.

The final results are as follows:

  

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.