MySQL:慢日志;追加CPU使用率
我启用了 MySQL 慢日志功能: http:// dev.mysql.com/doc/refman/5.1/en/slow-query-log.html
但有时 query_times 很高仅仅是因为 CPU 负载高。
如何将当前 CPU 负载附加到 MySQL 慢速日志中的每个条目(它写入文件)?
I have the MySQL slow log feature enabled: http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html
But sometimes the query_times are high simply due to high CPU load.
How can I append the current CPU load to each entry in the MySQL slow log (it writes to a file)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于查询速度慢,CPU 可能会很高。
MySQL 不会监控您的 CPU,因此您将需要第 3 方监控工具,并将 CPU 较高的时间与查询(已记录)运行的时间进行比较。
我使用 AWS,它有一些很好的监控功能,当 CPU 较高时我会收到警报,然后我可以追踪慢查询日志并查看哪些日志导致了它。
希望对一些人有所帮助。但我的猜测是 CPU 因查询而高,而不是查询因 CPU 而慢。只是一个猜测。
The CPU may be high due to the slow query.
MySQL does not monitor your CPU, so you are going to need a 3rd party monitoring tool and compare the times that CPU is high to the times the query (that is logged) is running.
I use AWS, which has some nice monitoring, and I get an alert when the CPU is high, then I can tail the Slow Query Log and see which ones are causing it.
Hope that helps some. But my guess is the CPU is high due to the query and not that the query is slow due to the CPU. Just a guess tho.