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 200% CPU Load

Discussion in 'Workarounds and Optimization' started by jimtrouble, Jan 6, 2019.

  1. jimtrouble

    jimtrouble Registered

    Joined:
    Jan 6, 2019
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Greece
    cPanel Access Level:
    Root Administrator
    Hello everybody and happy new year!

    I have a problem with my VPS. Almost all the time the mysql has about 200% cpu load.
    I tried some tweaks with mysqltunner.pl but still the same.

    This is the config on my.cnf
    Code:
    [mysqld]
    key_buffer=8000M
    default-storage-engine=MyISAM
    innodb_file_per_table=1
    performance-schema=0
    max_allowed_packet=268435456
    open_files_limit=10000
    query_cache_type=0
    query_cache_size=0
    query_cache_limit=20M
    join_buffer_size=50M
    tmp_table_size=500M
    max_heap_table_size=500M
    performance_schema=ON
    innodb_buffer_pool_size=6192M
    innodb_log_file_size=774M
    innodb_buffer_pool_instances=6
    
    Can you help me solve it please?
    Thank you!
     
  2. xata11

    xata11 Member

    Joined:
    Oct 17, 2018
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Port harcourt
    cPanel Access Level:
    Root Administrator
    Post your mysqltuner result here
     
  3. jimtrouble

    jimtrouble Registered

    Joined:
    Jan 6, 2019
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Greece
    cPanel Access Level:
    Root Administrator
    Hello.

    My VPS is 6 cores Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz and 26GB of RAM. The hd is ssd.

    This is my current my.cnf file as it was changed due to innodb corruption.

    Code:
    [mysqld]
    #key_buffer=2000M
    default-storage-engine=MyISAM
    innodb_file_per_table=1
    performance-schema=0
    max_allowed_packet=268435456
    open_files_limit=10000
    #query_cache_type=0
    #query_cache_size=0
    #query_cache_limit=20M
    #join_buffer_size=50M
    #tmp_table_size=500M
    #max_heap_table_size=500M
    #performance_schema=ON
    innodb_buffer_pool_size=128M
    innodb_log_file_size=774M
    #innodb_buffer_pool_instances=6
    innodb_force_recovery=0
     
  4. jimtrouble

    jimtrouble Registered

    Joined:
    Jan 6, 2019
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Greece
    cPanel Access Level:
    Root Administrator
    And this is the output from mysqltuner:

    Code:
     >>  MySQLTuner 1.7.14 - Major Hayden <[email protected]>
     >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
     >>  Run with '--help' for additional options and output filtering
    
    [--] Skipped version check for MySQLTuner script
    [OK] Currently running supported MySQL version 10.2.21-MariaDB
    [OK] Operating on 64-bit architecture
    
    -------- Log file Recommendations ------------------------------------------------------------------
    [--] Log file: /var/lib/mysql/mia.innoglobe.eu.err(785K)
    [OK] Log file /var/lib/mysql/mia.innoglobe.eu.err exists
    [OK] Log file /var/lib/mysql/mia.innoglobe.eu.err is readable.
    [OK] Log file /var/lib/mysql/mia.innoglobe.eu.err is not empty
    [OK] Log file /var/lib/mysql/mia.innoglobe.eu.err is smaller than 32 Mb
    [!!] /var/lib/mysql/mia.innoglobe.eu.err contains 49 warning(s).
    [!!] /var/lib/mysql/mia.innoglobe.eu.err contains 3939 error(s).
    [--] 8 start(s) detected in /var/lib/mysql/mia.innoglobe.eu.err
    [--] 1) 2019-01-08 14:04:32 140082303482048 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 2) 2019-01-08 14:04:22 139660386863296 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 3) 2019-01-08 14:02:01 140226220710144 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 4) 2019-01-08 14:01:50 140440850802944 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 5) 190108 13:59:15 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 6) 2019-01-08 11:09:37 4643 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 7) 2019-01-08 11:08:57 4342 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 8) 2019-01-08 11:05:49 3811 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 7 shutdown(s) detected in /var/lib/mysql/mia.innoglobe.eu.err
    [--] 1) 2019-01-08 14:04:30 139659945621248 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 2) 2019-01-08 14:03:02 140226137938688 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 3) 2019-01-08 14:02:00 140440849537792 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 4) 190108 14:00:33 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 5) 2019-01-08 13:58:26 4643 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 6) 2019-01-08 11:09:26 4342 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 7) 2019-01-08 11:08:45 3811 [Note] /usr/sbin/mysqld: Shutdown complete
    
    -------- Storage Engine Statistics -----------------------------------------------------------------
    [--] Status: +Aria +CSV +InnoDB +MEMORY +MRG_MyISAM +MyISAM +PERFORMANCE_SCHEMA +SEQUENCE
    [--] Data in MyISAM tables: 285.4M (Tables: 1639)
    [--] Data in InnoDB tables: 2.1G (Tables: 662)
    [--] Data in MEMORY tables: 0B (Tables: 21)
    [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: 4m 10s (32K q [128.804 qps], 330 conn, TX: 143M, RX: 15M)
    [--] Reads / Writes: 79% / 21%
    [--] Binary logging is disabled
    [--] Physical Memory     : 23.4G
    [--] Max MySQL memory    : 856.4M
    [--] Other process memory: 0B
    [--] Total buffers: 417.0M global + 2.9M per thread (151 max threads)
    [--] P_S Max memory usage: 0B
    [--] Galera GCache Max memory usage: 0B
    [OK] Maximum reached memory usage: 451.9M (1.89% of installed RAM)
    [OK] Maximum possible memory usage: 856.4M (3.58% of installed RAM)
    [OK] Overall possible memory usage with other process is compatible with memory available
    [OK] Slow queries: 0% (0/32K)
    [OK] Highest usage of available connections: 7% (12/151)
    [OK] Aborted connections: 0.91%  (3/330)
    [!!] 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.
    [!!] Query cache efficiency: 0.0% (0 cached / 24K selects)
    [OK] Query cache prunes per day: 0
    [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 4K sorts)
    [!!] Joins performed without indexes: 130
    [!!] Temporary tables created on disk: 84% (2K on disk / 2K total)
    [OK] Thread cache hit rate: 96% (12 created / 330 connections)
    [OK] Table cache hit rate: 97% (238 open / 244 opened)
    [OK] Open file limit used: 2% (213/10K)
    [OK] Table locks acquired immediately: 100% (3K immediate / 3K locks)
    
    -------- Performance schema ------------------------------------------------------------------------
    [--] Performance schema is disabled.
    [--] Memory used by P_S: 0B
    [--] Sys schema isn't installed.
    
    -------- ThreadPool Metrics ------------------------------------------------------------------------
    [--] ThreadPool stat is enabled.
    [--] Thread Pool Size: 6 thread(s).
    [--] Using default value is good enough for your version (10.2.21-MariaDB)
    
    -------- MyISAM Metrics ----------------------------------------------------------------------------
    [!!] Key buffer used: 19.2% (25M used / 134M cache)
    [OK] Key buffer size / total MyISAM indexes: 128.0M/36.4M
    [OK] Read Key buffer hit rate: 99.6% (294K cached / 1K reads)
    [OK] Write Key buffer hit rate: 99.4% (849 cached / 844 writes)
    
    -------- InnoDB Metrics ----------------------------------------------------------------------------
    [--] InnoDB is enabled.
    [--] InnoDB Thread Concurrency: 0
    [OK] InnoDB File per table is activated
    [!!] InnoDB buffer pool / data size: 128.0M/2.1G
    [!!] Ratio InnoDB log file size / InnoDB Buffer pool size (1209.375 %): 774.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.92% (934165505 hits/ 934896157 total)
    [!!] InnoDB Write Log efficiency: 79.87% (23540 hits/ 29473 total)
    [OK] InnoDB log waits: 0.00% (0 waits / 5933 writes)
    
    -------- AriaDB Metrics ----------------------------------------------------------------------------
    [--] AriaDB is enabled.
    [OK] Aria pagecache size / total Aria indexes: 128.0M/1B
    [!!] Aria pagecache hit rate: 94.4% (38K cached / 2K reads)
    
    -------- 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: MIXED
    [--] 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/lib/mysql/mia.innoglobe.eu.err file
        Control error line(s) into /var/lib/mysql/mia.innoglobe.eu.err 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
        Adjust your join queries to always utilize indexes
        When making adjustments, make tmp_table_size/max_heap_table_size equal
        Reduce your SELECT DISTINCT queries which have no LIMIT clause
        Performance schema should be activated for better diagnostics
        Consider installing Sys schema from https://github.com/mysql/mysql-sys for MySQL
        Consider installing Sys schema from https://github.com/good-dba/mariadb-sys for MariaDB
        Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: https://bit.ly/2TcGgtU
    Variables to adjust:
        query_cache_size (=0)
        query_cache_type (=0)
        query_cache_limit (> 1M, or use smaller result sets)
        join_buffer_size (> 256.0K, or always use indexes with JOINs)
        tmp_table_size (> 16M)
        max_heap_table_size (> 16M)
        performance_schema = ON enable PFS
        innodb_buffer_pool_size (>= 2.1G) if possible.
        innodb_log_file_size should be (=16M) if possible, so InnoDB total log files size equals to 25% of buffer pool size
     
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,503
    Likes Received:
    2,179
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @jimtrouble,

    You'll want to leave MySQL running for at least 24 hours before running the tuner to get accurate results. Can you run the tuner again once MySQL has been running for ~24 hours?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

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