Server is slow due to high CPU usage by mysql process

Created:

2017-06-01 12:15:52 UTC

Modified:

2017-08-16 16:28:30 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Server is slow due to high CPU usage by mysql process

Applicable to:

  • Plesk for Linux

Symptoms

Huge value of CPU usage of mysql (more than 100% in peaks).

Multiple "slow queries" to database, according to How to troubleshoot High CPU usage by MySQL? article.

Cause

myqsl database server is not tuned/optimized.

Resolution

Note : Enlarging values may assume server performance. Made sure that you have enough RAM.

Allocate RAM memory for innodb buffer pool_size and query cache size in /etc/my.cnf for Plesk on RedHat based OS ( /etc/mysql/my.cnf for Plesk on Debian-based OS):

  1. Open my.cnf in text editor.

  2. Set the following values in [mysqld] section:

    innodb_buffer_pool_size = 1024M
    
    query_cache_size = 64M
  3. Save file and restart mysql server:

    service mysqld restart
    
  4. Monitor value of CPU during 3-5 minutes.

  5. If CPU usage is still high enlarge current value of innodb_buffer_pool_size on 1024M and query_cache_size on 64M and repeat steps 3-5.

Have more questions? Submit a request
Please sign in to leave a comment.