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.

my.cnf Optimization Help Please

Discussion in 'Workarounds and Optimization' started by MrMagoo, Sep 4, 2013.

  1. MrMagoo

    MrMagoo Member

    Joined:
    Sep 6, 2005
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    Please assist with recommendations for my.cnf - dedicated server performance very slow.

    Thanks in advance.

    Code:
    free -m
                 total       used       free     shared    buffers     cached
    Mem:          7500       1757       5742          0          0          0
    -/+ buffers/cache:       1757       5742
    Swap:            0          0          0
    Code:
    [mysqld]
    #skip-grant-tables
    local-infile=0
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    skip-locking
    skip-innodb
    query_cache_limit=64M
    query_cache_size=128M
    query_cache_type=1
    max_user_connections=500
    max_connections=1000
    interactive_timeout=10
    wait_timeout=10
    connect_timeout=10
    thread_cache_size=128
    key_buffer_size=256M
    join_buffer_size=512M
    max_heap_table_size=256M
    tmp_table_size=256M
    max_allowed_packet=16M
    table_cache=2048
    record_buffer=1M
    sort_buffer_size=4M
    read_buffer_size=4M
    max_connect_errors=10
    thread_concurrency=8
    myisam_sort_buffer_size=64M
    server-id=1
    bind-address=125.214.73.213
    #[mysql.server]
    #user=mysql
    #basedir=/var/lib 
    
    open_files_limit=7972
    [safe_mysqld]
    err-log=/var/log/mysqld.log
    pid-file=/var/lib/mysql/mysql.pid
    
    #[mysqldump]
    #quick
    max_allowed_packet=16M
    
    [mysql]
    no-auto-rehash
    
    [isamchk]
    key_buffer=256M
    sort_buffer=256M
    read_buffer=16M
    write_buffer=16M 
    
    [myisamchk]
    key_buffer=256M
    sort_buffer=256M
    read_buffer=16M
    write_buffer=16M
    
    [mysqlhotcopy]
    interactive-timeout
    
    log-slow-queries=/var/lib/mysql/slow.log
    Code:
     >>  MySQLTuner 1.0.1 - Major Hayden <major@mhtx.net>
     >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
     >>  Run with '--help' for additional options and output filtering
    
    -------- General Statistics --------------------------------------------------
    [--] Skipped version check for MySQLTuner script
    [OK] Currently running supported MySQL version 5.0.96-community
    [OK] Operating on 64-bit architecture
    
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +Archive -BDB -Federated -InnoDB -ISAM -NDBCluster 
    [--] Data in MyISAM tables: 3G (Tables: 1299)
    [!!] Total fragmented tables: 26
    
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 20m 13s (84K q [69.830 qps], 8K conn, TX: 165M, RX: 13M)
    [--] Reads / Writes: 72% / 28%
    [--] Total buffers: 650.0M global + 520.5M per thread (1000 max threads)
    [!!] Maximum possible memory usage: 508.9G (6948% of installed RAM)
    [OK] Slow queries: 0% (0/84K)
    [OK] Highest usage of available connections: 6% (60/1000)
    [OK] Key buffer size / total MyISAM indexes: 256.0M/1.4G
    [OK] Key buffer hit rate: 99.9% (9M cached / 5K reads)
    [OK] Query cache efficiency: 75.2% (38K cached / 51K selects)
    [OK] Query cache prunes per day: 0
    [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 5K sorts)
    [!!] Joins performed without indexes: 1137
    [!!] Temporary tables created on disk: 42% (1K on disk / 3K total)
    [OK] Thread cache hit rate: 99% (60 created / 8K connections)
    [OK] Table cache hit rate: 99% (1K open / 1K opened)
    [OK] Open file limit used: 34% (2K/7K)
    [!!] Table locks acquired immediately: 94%
    
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Run OPTIMIZE TABLE to defragment tables for better performance
        MySQL started within last 24 hours - recommendations may be inaccurate
        Reduce your overall MySQL memory footprint for system stability
        Enable the slow query log to troubleshoot bad queries
        Adjust your join queries to always utilize indexes
        Temporary table size is already large - reduce result set size
        Reduce your SELECT DISTINCT queries without LIMIT clauses
        Optimize queries and/or use InnoDB to reduce lock wait
    Variables to adjust:
      *** MySQL's maximum memory usage is dangerously high ***
      *** Add RAM before increasing MySQL buffer variables ***
        join_buffer_size (> 512.0M, or always use indexes with joins)
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,811
    Likes Received:
    671
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    MySQL was only running for 20 minutes when you ran the MySQL tuner script:

    Please let it run for at least 24 hours before running the MySQL tuner script to ensure accurate results.

    Thank you.
     
  3. thinkbot

    thinkbot Well-Known Member

    Joined:
    Oct 30, 2012
    Messages:
    326
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Ohh, some of your settings are horrible, without any understanding (like join_buffer_size)

    Please adjust those:

    query_cache_limit=2M
    query_cache_size=50M

    max_user_connections=100
    max_connections=300

    key_buffer_size=2000M
    join_buffer_size=2M
    sort_buffer_size=256K
    read_buffer_size=128K

    and add slow query tracking (becouse of a lot queries creating temp files on disk)

    slow_query_log=1
    slow_query_log_file=mysql-slow.log
    long_query_time=0.1
    log-queries-not-using-indexes

    then restart, after a while please run mysqltuner again, and show us here the result
    plus,
    on slow log, run pt-query-digest

    cd /root;
    wget http://percona.com/get/pt-query-digest
    chmod +x pt-query-digest
    ./pt-query-digest /var/lib/mysql/mysql-slow.log > slow.txt

    and copy slow.txt here, for slow queries review

    btw. are you using some CMS with third party plugins, or custom code ?
     
Loading...

Share This Page