Results 1 to 2 of 2

Thread: Help with MySQL optimisation

  1. #1
    Member
    Join Date
    Aug 2003
    Posts
    5

    Default Help with MySQL optimisation

    Hey guys,

    I lost my custom mysql.cnf due to a hard drive meltdown. Hoping someone can help me tweak the configuration.

    This is a dedicated box running Core2 Duo CPU E6750 @ 2.66GHz, 4Gb RAM.

    The default my.cnf


    Code:
    [mysqld]
    innodb_file_per_table=1
    default-storage-engine=MyISAM
    
    character-set-server=utf8
    collation-server=utf8_bin
    
    max_allowed_packet= 64M
    wait_timeout= 6000

    Here is my mysqltuner.pl output


    Code:
    >>  MySQLTuner 1.1.2 - 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.5.24-cll
    [!!] Switch to 64-bit OS - MySQL cannot currently use all of your RAM
    
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
    [--] Data in MyISAM tables: 1000M (Tables: 10530)
    [--] Data in InnoDB tables: 169M (Tables: 2704)
    [--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
    [--] Data in MEMORY tables: 0B (Tables: 7)
    [!!] Total fragmented tables: 3180
    
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 1d 20h 23m 18s (8M q [53.694 qps], 59K conn, TX: 13B, RX: 1B)
    [--] Reads / Writes: 97% / 3%
    [--] Total buffers: 168.0M global + 2.7M per thread (151 max threads)
    [OK] Maximum possible memory usage: 573.8M (14% of installed RAM)
    [OK] Slow queries: 0% (13/8M)
    [OK] Highest usage of available connections: 11% (18/151)
    [OK] Key buffer size / total MyISAM indexes: 8.0M/215.7M
    [OK] Key buffer hit rate: 99.1% (48M cached / 433K reads)
    [!!] Query cache is disabled
    [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 334K sorts)
    [!!] Joins performed without indexes: 29534
    [!!] Temporary tables created on disk: 34% (133K on disk / 382K total)
    [!!] Thread cache is disabled
    [!!] Table cache hit rate: 0% (400 open / 275K opened)
    [OK] Open file limit used: 61% (625/1K)
    [OK] Table locks acquired immediately: 99% (8M immediate / 8M locks)
    [!!] InnoDB data size / buffer pool: 169.7M/128.0M
    
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Run OPTIMIZE TABLE to defragment tables for better performance
        Enable the slow query log to troubleshoot bad queries
        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 without LIMIT clauses
        Set thread_cache_size to 4 as a starting value
        Increase table_cache gradually to avoid file descriptor limits
    Variables to adjust:
        query_cache_size (>= 8M)
        join_buffer_size (> 128.0K, or always use indexes with joins)
        tmp_table_size (> 16M)
        max_heap_table_size (> 16M)
        thread_cache_size (start at 4)
        table_cache (> 400)
        innodb_buffer_pool_size (>= 169M)
    I tried myself to add the "Variables to Adjust", listed in the above. however, Mysql would refuse to start.

    Grateful for any assistance which can be provided.

    Cheers
    Drinky

  2. #2
    Member
    Join Date
    Jun 2011
    Posts
    99
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Help with MySQL optimisation

    Code:
    [mysqld]
    # Query Cache
    query_cache_size=128M
    query_cache_limit=8M
    query_cache_type=1
    
    # Thread Settings
    thread_cache_size=8
    
    # Slow Log
    slow-query-log=1
    slow-query-log-file="/var/log/mysql-slow-queries.log"
    #log_queries_not_using_indexes = 1
    long_query_time=2
    
    # File Descriptor
    table_open_cache=8192
    
    # Misc Settings
    max_allowed_packet=64M
    local-infile=0
    default-storage-engine=MyISAM
    innodb_file_per_table=1
    
    # Buffer Settings
    innodb_buffer_pool_size=200M
    key_buffer_size=240M
    read_buffer_size=256K
    sort_buffer_size=256K
    join_buffer_size=256K
    
    # Connection Settings
    max_connections=200
    
    # Timing Settings
    # Optional Custom Timeouts (change as desired)
    #wait_timeout=300
    #connect_timeout=300
    #interactive_timeout=1000
    
    # Temp Tables
    tmp_table_size=64M
    max_heap_table_size=64M
    
    [mysqld_safe]
    pid-file="/var/run/mysqld/mysqld.pid"
    open_files_limit=16384
    log-error="/var/log/mysqld.log"
    That should get you going, and if you like to post another tuner report after a few days. I can help you tweak more if needed.

    You can replace yours completely with this, as this has all the lines yours currently has.

    Also make sure this file exists.
    /var/log/mysql-slow-queries.log if not create it and give mysql permissions.
    Last edited by srpurdy; 07-06-2012 at 01:43 PM.

Similar Threads

  1. optimisation for mpm worker and mod_fcgi
    By swany in forum Optimization
    Replies: 1
    Last Post: 10-11-2011, 07:08 PM
  2. Apache Optimisation during Backup
    By micxnet in forum Optimization
    Replies: 4
    Last Post: 01-20-2011, 07:45 PM
  3. Spamassassin resource optimization (optimisation)
    By santrix in forum cPanel & WHM Discussions
    Replies: 0
    Last Post: 02-13-2009, 03:50 AM
  4. server optimisation tips
    By Haloweb in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 04-29-2005, 07:23 AM