开发者

High MySQL CPU usage but no heavy query

开发者 https://www.devze.com 2023-02-08 18:49 出处:网络
When I run \"top\" command on my Linux it shows that MySQL is taking 400%-500% CPU usage. But when I run \'watch mysqladmin pr\" command to see a list of queries being run by MySQL then it shows just

When I run "top" command on my Linux it shows that MySQL is taking 400%-500% CPU usage. But when I run 'watch mysqladmin pr" command to see a list of queries being run by MySQL then it shows just 2, 3 queries and that too only taking 2, 3 seconds. The "top" command shows MySQL constantly fluctuating CPU usage like 130%, 200%, 340%,开发者_如何学编程 230%, 400%, 440%, 635%, 335% e.t.c. but "watch mysqladmin pr" command is not showing queries that are taking up CPU usage. How do I check why MySQL is using so much CPU?

Thanks


Could it be a huge transaction being rolled back? This will show 100% cpu but no active queries. Restarting mysql won't help as the rollback continues after a restart source: second section on huge transactions)

If you run show engine innodb status (assuming you're running innodb) there is information under the TRANSACTION heading - something along the lines of:

---TRANSACTION 7AB09, ACTIVE 3601 sec rollback ROLLING BACK 48157 lock struct(s), heap size 5585336, 2856641 row lock(s), undo log entries 4921485 MySQL thread id 53, OS thread handle 0x7f3d503ab700, query id 4937822 localhost 127.0.0.1 user

0

精彩评论

暂无评论...
验证码 换一张
取 消