High CPU usage for /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Operating System & Version
Linux

sanzatg

Registered
Jul 11, 2021
2
0
1
Ghana
cPanel Access Level
Root Administrator
I have 100.16% or more most times for /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid CPU usage.

mysqladmin processlist gave the following results:


+-------+---------------------+-----------+---------------------+---------+------+-----------+------------------------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-------+---------------------+-----------+---------------------+---------+------+-----------+------------------------------------------------------------------------------------------------------+
| 28484 | tv24hr_musicliberia | localhost | tv24hr_musicliberia | Sleep | 19 | | |
| 28592 | asembi_abtc | localhost | asembi_abtc | Sleep | 1 | | |
| 28593 | tv24hr_musicliberia | localhost | tv24hr_musicliberia | Sleep | 1 | | |
| 28594 | tv24hr_musicliberia | localhost | tv24hr_musicliberia | Sleep | 1 | | |
| 28602 | asembi_abtc | localhost | asembi_abtc | Query | 0 | query end | INSERT INTO `wp_6v4bk6s5y2_options` (`option_name`, `option_value`, `autoload`) VALUES ('rocket_rucs |
| 28606 | tv24hr_musicliberia | localhost | tv24hr_musicliberia | Sleep | 1 | | |
| 28609 | asembi_abtc | localhost | asembi_abtc | Query | 0 | query end | UPDATE `wp_6v4bk6s5y2_wpr_rucss_resources` SET `url` = 'https://abtc.ng/wp-includes/js/jquery/jquery |
| 28611 | asembi_abtc | localhost | asembi_abtc | Sleep | 0 | | |
| 28612 | asembi_abtc | localhost | asembi_abtc | Sleep | 0 | | |
| 28613 | tv24hr_edu | localhost | tv24hr_edu | Sleep | 0 | | |
| 28614 | root | localhost | | Query | 0 | starting | show processlist


Can someone assist me with what to do?
 

HostNoc

Well-Known Member
Feb 20, 2020
157
38
28
Ontario
cPanel Access Level
Root Administrator
Hi
From the stats you shared, it seems your mysql query goes in to sleep status and it did not execute, so please check your queies which is going in sleep mode and optimize it
regards
 
  • Like
Reactions: cPRex

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
16,505
2,605
363
cPanel Access Level
Root Administrator
I agree with the "sleep" state issue, but you may want to try this slightly different command to get a summary of what is happening on the server as well:

Code:
mysqladmin proc status
as this will give you an overview of what the MySQL server is processing on the machine in real-time.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
16,505
2,605
363
cPanel Access Level
Root Administrator
We have a list of admins that advertise their specialty with cPanel servers here:


We can't recommend anyone in particular but there are reviews and ratings on that page as well.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
16,505
2,605
363
cPanel Access Level
Root Administrator
I see your open_tables is sitting at 2000. Is that the limit on your server? You can fun this command directly from SSH to see that number:

Code:
mysql -e "show variables;" | grep table_open_cache
If that is set to 2000 and you're hitting your limit, consider raising that value. This should let MySQL use more RAM, but less CPU.