I have an issue where 2 processes take 99% of the CPU, but that leaves me the mysqld process that takes 600% of the CPU and a set of php-fpm processes that takes no more than 25% of the CPU according to top (2 process alive and 603 processes sleeping, one of them is the mysqld and the other seems to be a php-fpm, so it's not coming from too many clients), so I am wondering what might cause the high CPU usage, because doing SHOW FULL PROCESSLIST gives me nothing but a few SELECT commands like 2 or 3, and nothing out of ordinary, how do I find out what's wrong? I was told it's the rsync process, but the rsync process should only take a lot of IO and no CPU usage, and the issue is that CPU is at 99% when there's only 2 process, and doing SHOW FULL PROCESSLIST doesn't reveal why the CPU usage is so high, so how do you debug this? Is there a command that allows you to check past MYSQL queries, because I was told if there's a dump to MYSQL it won't necessary appear when I run SHOW FULL PROCESSLIST, so I am wondering if there's a way to check all of the queries that were completed recently instead.
Asked
Active
Viewed 91 times
0
-
1Check the slow query log. – Michael Hampton Sep 20 '21 at 22:10
-
When you find the naughty query via the slowlog, use stackoverflow.com to ask for optimization help. – Rick James Sep 21 '21 at 00:34
-
Consider posting to pastebin.com TEXT results of A) htop and B) SHOW FULL PROCESSLIST; so we can see your available information. This url may convince you to avoid DIRECT rsync use - https://www.sitepoint.com/community/t/backup-mysql-with-rsync/61927 and last, 603 sleeping processes when your server is essentially idle is a clue someone is not using CLOSE to end the connection when done with processing. Please post your code that CONNects, PROCESSESS and CLOSES the connection into pastebin.com and share the links. – Wilson Hauck Sep 21 '21 at 18:43