In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to add thread memory monitoring to MySQL database". The explanation in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian and go deep into it slowly to study and learn "how to add thread memory monitoring to MySQL database" together!
Using MySQL I often find that mysqld memory usage will rise very fast (Buffer Pool is allocated by large pages), so that using SWAP, how much memory is used by the Server layer, there is no monitoring mechanism, so the first step I wrote a patch(based on 5.6.6) to monitor how much memory is used by each thread, once mysqld process uses too much memory, to see which threads use more, kill these threads.
The patch looks like this:
This is the effect after patched:
The code can be viewed as patch.
5.6_thread_mem_usage.patch
The basic method is to add callback functions to my_malloc and my_free (@ Taobao Dingqi provides ideas, too handsome), get the THD descriptor that calls my_malloc and my_free functions, and use the newly added malloc_size field in THD to record the application and release of memory. In fact, my_realloc should also update malloc_size, which has not been added yet.
Then use the malloc_usable_size function to determine how much memory the pointer requests when free, and use malloc_size(pointer) to determine above GCC 4.2.
Thank you for reading, the above is "how to add thread memory monitoring to MySQL database" content, after the study of this article, I believe we have a deeper understanding of how to add thread memory monitoring to MySQL database, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.