Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

MYSQL high cpu usage issue

Discussion in 'Workarounds and Optimization' started by Maning, Oct 13, 2018.

  1. Maning

    Maning Active Member

    Jun 29, 2017
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    my mysql is using about 70-80% every time of cpu and about 5% memory,
    and many times when high traffic, websites takes too long to load (and load goes up to 120%)

    my server is i7-6700 with 64gb ram, im using centos 7.5

    here is my my.cnf and mysqltuner log

    could someone help me?

    my my.cnf
    query_cache_size = 134217728
    query_cache_limit = 1048576
    query_cache_type = 1
    MySQLTuner report
     >>  MySQLTuner 1.7.13 - Major Hayden <>
     >>  Bug reports, feature requests, and downloads at
     >>  Run with '--help' for additional options and output filtering
    [--] Skipped version check for MySQLTuner script
    [OK] Currently running supported MySQL version 5.7.23
    [OK] Operating on 64-bit architecture
    -------- Log file Recommendations ------------------------------------------------------------------
    [--] Log file: /var/log/mysqld.log(51K)
    [OK] Log file /var/log/mysqld.log exists
    [OK] Log file /var/log/mysqld.log is readable.
    [OK] Log file /var/log/mysqld.log is not empty
    [OK] Log file /var/log/mysqld.log is smaller than 32 Mb
    [!!] /var/log/mysqld.log contains 30 warning(s).
    [OK] /var/log/mysqld.log doesn't contain any error.
    [--] 7 start(s) detected in /var/log/mysqld.log
    [--] 1) 2018-10-13T15:05:12.511139Z 0 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 2) 2018-10-13T11:32:48.122869Z 0 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 3) 2018-10-13T07:51:22.220487Z 0 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 4) 2018-10-12T21:19:35.696050Z 0 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 5) 2018-10-12T19:56:32.623434Z 0 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 6) 2018-10-12T19:53:44.496282Z 0 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 7) 2018-10-12T19:00:01.782947Z 0 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 6 shutdown(s) detected in /var/log/mysqld.log
    [--] 1) 2018-10-13T15:05:11.787954Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 2) 2018-10-13T11:32:47.471613Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 3) 2018-10-13T07:51:21.589115Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 4) 2018-10-12T21:19:35.255549Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 5) 2018-10-12T19:55:29.363553Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 6) 2018-10-12T19:52:41.055263Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
    -------- Storage Engine Statistics -----------------------------------------------------------------
    [--] Data in InnoDB tables: 3.2G (Tables: 1282)
    [OK] Total fragmented tables: 0
    -------- Analysis Performance Metrics --------------------------------------------------------------
    [--] innodb_stats_on_metadata: OFF
    [OK] No stat updates during querying INFORMATION_SCHEMA.
    -------- Security Recommendations ------------------------------------------------------------------
    [OK] There are no anonymous accounts for any database users
    [OK] All database users have passwords assigned
    [!!] There is no basic password file list!
    -------- CVE Security Recommendations --------------------------------------------------------------
    [--] Skipped due to --cvefile option undefined
    -------- Performance Metrics -----------------------------------------------------------------------
    [--] Up for: 2h 6m 35s (157M q [20K qps], 16K conn, TX: 33G, RX: 25G)
    [--] Reads / Writes: 99% / 1%
    [--] Binary logging is disabled
    [--] Physical Memory     : 62.5G
    [--] Max MySQL memory    : 465.9M
    [--] Other process memory: 1.3G
    [--] Total buffers: 296.0M global + 1.1M per thread (151 max threads)
    [--] P_S Max memory usage: 0B
    [--] Galera GCache Max memory usage: 0B
    [OK] Maximum reached memory usage: 325.2M (0.51% of installed RAM)
    [OK] Maximum possible memory usage: 465.9M (0.73% of installed RAM)
    [OK] Overall possible memory usage with other process is compatible with memory available
    [OK] Slow queries: 0% (0/157M)
    [OK] Highest usage of available connections: 17% (26/151)
    [OK] Aborted connections: 0.01%  (1/16553)
    [!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance
    [!!] Query cache may be disabled by default due to mutex contention.
    [OK] Query cache efficiency: 98.8% (155M cached / 157M selects)
    [!!] Query cache prunes per day: 17096108
    [OK] Sorts requiring temporary tables: 0% (6K temp sorts / 841K sorts)
    [!!] Joins performed without indexes: 4730
    [OK] Temporary tables created on disk: 3% (18K on disk / 462K total)
    [OK] Thread cache hit rate: 98% (241 created / 16K connections)
    [!!] Table cache hit rate: 3% (2K open / 54K opened)
    [OK] Open file limit used: 0% (7/10K)
    [OK] Table locks acquired immediately: 100% (389 immediate / 389 locks)
    -------- Performance schema ------------------------------------------------------------------------
    [--] Performance schema is disabled.
    [--] Memory used by P_S: 0B
    [--] Sys schema is installed.
    -------- ThreadPool Metrics ------------------------------------------------------------------------
    [--] ThreadPool stat is disabled.
    -------- MyISAM Metrics ----------------------------------------------------------------------------
    [!!] Key buffer used: 18.3% (1M used / 8M cache)
    [OK] Key buffer size / total MyISAM indexes: 8.0M/47.0K
    [!!] Read Key buffer hit rate: 93.5% (508 cached / 33 reads)
    -------- InnoDB Metrics ----------------------------------------------------------------------------
    [--] InnoDB is enabled.
    [--] InnoDB Thread Concurrency: 0
    [OK] InnoDB File per table is activated
    [!!] InnoDB buffer pool / data size: 128.0M/3.2G
    [!!] Ratio InnoDB log file size / InnoDB Buffer pool size (75 %): 48.0M * 2/128.0M should be equal 25%
    [OK] InnoDB buffer pool instances: 1
    [--] Number of InnoDB Buffer Pool Chunk : 1 for 1 Buffer Pool Instance(s)
    [OK] Innodb_buffer_pool_size aligned with Innodb_buffer_pool_chunk_size & Innodb_buffer_pool_instances
    [OK] InnoDB Read buffer efficiency: 99.64% (931222730 hits/ 934624265 total)
    [OK] InnoDB Write log efficiency: 97.77% (1207665 hits/ 1235213 total)
    [OK] InnoDB log waits: 0.00% (0 waits / 27548 writes)
    -------- AriaDB Metrics ----------------------------------------------------------------------------
    [--] AriaDB is disabled.
    -------- TokuDB Metrics ----------------------------------------------------------------------------
    [--] TokuDB is disabled.
    -------- XtraDB Metrics ----------------------------------------------------------------------------
    [--] XtraDB is disabled.
    -------- Galera Metrics ----------------------------------------------------------------------------
    [--] Galera is disabled.
    -------- Replication Metrics -----------------------------------------------------------------------
    [--] Galera Synchronous replication: NO
    [--] No replication slave(s) for this server.
    [--] Binlog format: ROW
    [--] XA support enabled: ON
    [--] Semi synchronous replication Master: Not Activated
    [--] Semi synchronous replication Slave: Not Activated
    [--] This is a standalone server
    -------- Recommendations ---------------------------------------------------------------------------
    General recommendations:
        Control warning line(s) into /var/log/mysqld.log file
        MySQL was started within the last 24 hours - recommendations may be inaccurate
        Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
        Increasing the query_cache size over 128M may reduce performance
        Adjust your join queries to always utilize indexes
        Increase table_open_cache gradually to avoid file descriptor limits
        Read this before increasing table_open_cache over 64:
        Read this before increasing for MariaDB
        This is MyISAM only table_cache scalability problem, InnoDB not affected.
        See more details here:
        This bug already fixed in MySQL 5.7.9 and newer MySQL versions.
        Beware that open_files_limit (10000) variable
        should be greater than table_open_cache (2000)
        Performance schema should be activated for better diagnostics
        Before changing innodb_log_file_size and/or innodb_log_files_in_group read this:
    Variables to adjust:
        query_cache_size (=0)
        query_cache_type (=0)
        query_cache_size (> 128M) [see warning above]
        join_buffer_size (> 256.0K, or always use indexes with JOINs)
        table_open_cache (> 2000)
        performance_schema = ON enable PFS
        innodb_buffer_pool_size (>= 3.2G) if possible.
        innodb_log_file_size should be (=16M) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
  2. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Nov 14, 2017
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    DataCenter Provider
    Hi @Maning

    As far as the MySQL tuner recommendations go did you implement any of them and see a change?
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice