The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MySQL high CPU load

Discussion in 'Workarounds and Optimization' started by maxo-tt, Dec 22, 2012.

  1. maxo-tt

    maxo-tt Member

    Joined:
    Dec 22, 2012
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    hello people. i've just install Cpanel on Centos 6.3 (virtualization vmware esxi)

    i've just hosted a website (datalife engine with 4K visitor a day), got 70-90% CPU load. Load average about 1.5-2.0
    7
    Code:
    30522 (Trace) (Kill)	mysql	0	  74.8	0.2	/usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/server1.prohosting.ge.err --pid-file=/var/lib/mysql/server1.prohosting.ge.pid
    that's too much for my server, i had before Ispcp omega, and the website worked great. load average was 0.10 maximum


    i've already done:
    mysqlcheck -u root -r -e --auto-repair --check --optimize --al
    l-databases
    cnf file:
    [mysqld]
    innodb_buffer_pool_size = 13M
    max_heap_table_size = 48M
    query_cache_limit = 1M
    query_cache_size = 8M
    query_cache_type = 1
    table_cache = 80
    thread_cache_size = 4
    tmp_table_size = 48M



    tuner
    Code:
    root@server1 [/home]# ./tuner
    
     >>  MySQLTuner 1.2.0 - Major Hayden <major@mhtx.net>
     >>  Bug reports, feature requests, and downloads at [url]http://mysqltuner.com/[/url]
     >>  Run with '--help' for additional options and output filtering
    
    -------- General Statistics --------------------------------------------------
    [--] Skipped version check for MySQLTuner script
    [OK] Currently running supported MySQL version 5.1.66-cll
    [OK] Operating on 64-bit architecture
    
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
    [--] Data in MyISAM tables: 398M (Tables: 207)
    [--] Data in InnoDB tables: 1M (Tables: 71)
    [--] Data in MEMORY tables: 0B (Tables: 2)
    [!!] Total fragmented tables: 77
    
    -------- Security Recommendations  -------------------------------------------
    [OK] All database users have passwords assigned
    
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 17m 44s (193K q [182.263 qps], 20K conn, TX: 129M, RX: 19M)
    [--] Reads / Writes: 93% / 7%
    [--] Total buffers: 79.0M global + 2.7M per thread (151 max threads)
    [OK] Maximum possible memory usage: 494.2M (4% of installed RAM)
    [OK] Slow queries: 0% (0/193K)
    [OK] Highest usage of available connections: 5% (9/151)
    [OK] Key buffer size / total MyISAM indexes: 8.0M/102.2M
    [OK] Key buffer hit rate: 99.3% (8M cached / 57K reads)
    [OK] Query cache efficiency: 87.8% (95K cached / 109K selects)
    [OK] Query cache prunes per day: 0
    [OK] Sorts requiring temporary tables: 0% (7 temp sorts / 8K sorts)
    [!!] Joins performed without indexes: 25
    [OK] Temporary tables created on disk: 3% (174 on disk / 5K total)
    [OK] Thread cache hit rate: 99% (119 created / 20K connections)
    [OK] Table cache hit rate: 51% (80 open / 156 opened)
    [OK] Open file limit used: 14% (150/1K)
    [OK] Table locks acquired immediately: 98% (15K immediate / 16K locks)
    [OK] InnoDB data size / buffer pool: 1.5M/13.0M
    
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Run OPTIMIZE TABLE to defragment tables for better performance
        MySQL started within last 24 hours - recommendations may be inaccurate
        Enable the slow query log to troubleshoot bad queries
        Adjust your join queries to always utilize indexes
    Variables to adjust:
        join_buffer_size (> 128.0K, or always use indexes with joins)

    mysql_config --version -> 5.1.66


    any idea? please help
    :confused:
     
    #1 maxo-tt, Dec 22, 2012
    Last edited: Dec 22, 2012
  2. maxo-tt

    maxo-tt Member

    Joined:
    Dec 22, 2012
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    new tuner
    Variables to adjust:
    *** MySQL's maximum memory usage is dangerously high ***
    *** Add RAM before increasing MySQL buffer variables ***
    join_buffer_size (> 150.0M, or always use indexes with joins)

    what that means?
     
  3. srpurdy

    srpurdy Well-Known Member

    Joined:
    Jun 1, 2011
    Messages:
    101
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    150M join buffer? that's huge... make 256K, that's why your memory is so high, and if your getting a lot of joins without indexes than you need to optimize the database itself.

    I would make
    key_buffer_size = 120M
    join_buffer_size = 256K

    This is most likely your problem.
     
  4. maxo-tt

    maxo-tt Member

    Joined:
    Dec 22, 2012
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    thanks for reply.

    i tried this settings. but the same again. i dont have memory problem, but CPU... uses too much... that's not normal...

    now my cnf looks like:

    [mysqld]
    innodb_buffer_pool_size = 13M
    max_heap_table_size = 48M
    query_cache_limit = 1M
    query_cache_size = 70M
    query_cache_type = 1
    table_cache = 900
    thread_cache_size = 4
    tmp_table_size = 48M
    join_buffer_size = 256K
    skip-name-resolve
    skip-external-locking
    federated
    key_buffer_size = 120MB
    max_allowed_packet=16M

    at old server i had one core dou processor and load average was maximum 0.5

    now i have 2X xeon X5570 running and load average is 3-4

    thats too strange. i tried many kind of config of .cnf i think its another problem

    old sql version
    | protocol_version | 10 |
    | version | 5.1.61-0+squeeze1 |
    | version_comment | (Debian) |
    | version_compile_machine | x86_64 |
    | version_compile_os | debian-linux-gnu




    new sql version
    protocol_version 10
    version 5.1.66-cll
    version_comment MySQL Community Server (GPL)
    version_compile_machine x86_64
    version_compile_os unknown-linux-gnu


    p.s

    i did optimize with this command. anything other is needed?

    mysqlcheck -u root -r -e --auto-repair --check --optimize --al
    l-databases



    /http://i47.tinypic.com/26122j7.jpg
     
    #4 maxo-tt, Dec 24, 2012
    Last edited: Dec 24, 2012
Loading...

Share This Page