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!

my.cnf optimization

Discussion in 'Workarounds and Optimization' started by tmaster100, Apr 26, 2010.

  1. tmaster100

    tmaster100 Registered

    Apr 26, 2010
    Likes Received:
    Trophy Points:
    Hi everyone,

    I have a new server to which i am optimizing now and just wondering if anyone would be up for any suggestions on my my.cnf file to help ensure MySQL runs at it's best.

    The Server is a 2 x Dual Core Xeon (shows 8 cores with HT) with 4GB Memory and 2 x 146GB SAS (RAID 1). It's running Centos 5 (64bit) and cPanel of course.

    There are some phpBB forums being used as well as some Interspire installations so database speeds are important.

    Here is my current my.cnf

    local-infile = 0
    max_connections = 500
    key_buffer = 128M
    myisam_sort_buffer_size = 64M
    join_buffer_size = 1M
    read_buffer_size = 2M
    sort_buffer_size = 2M
    read_rnd_buffer_size = 2M
    table_cache = 1024
    record_buffer = 1M
    thread_cache_size = 128
    wait_timeout = 30
    connect_timeout = 10
    interactive_timeout = 10
    tmp_table_size = 64M
    max_heap_table_size = 64M
    max_allowed_packet = 16M
    max_connect_errors = 10
    query_cache_limit = 1M
    query_cache_size = 64M
    query_cache_type = 1
    thread_concurrency = 4


    open_files_limit = 8192

    max_allowed_packet = 100M


  2. ThomasC

    ThomasC Member

    Feb 7, 2003
    Likes Received:
    Trophy Points:
    Edinburgh, UK

    A good place to start would be to run MySQLTuner.

    MySQLTuner is a Perl script that analyzes your MySQL performance and, based on the statistics it gathers, gives recommendations which variables you should adjust in order to increase performance. That way, you can tune your my.cnf file to tease out the last bit of performance from your MySQL server and make it work more efficiently.

    # wget
    # perl

    It gives the following output

    server1:~# ./

    >> MySQLTuner 0.9.8 - Major Hayden <>
    >> Bug reports, feature requests, and downloads at MySQLTuner
    >> Run with '--help' for additional options and output filtering
    Please enter your MySQL administrative login: <-- root
    Please enter your MySQL administrative password: <-- yourrootsqlpassword

    -------- General Statistics --------------------------------------------------
    [--] Skipped version check for MySQLTuner script
    [!!] Your MySQL version 4.1.11-Debian_etch1-log is EOL software! Upgrade soon!
    [OK] Operating on 32-bit architecture with less than 2GB RAM

    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +Archive -BDB -Federated +InnoDB +ISAM -NDBCluster
    [--] Data in MyISAM tables: 301M (Tables: 2074)
    [--] Data in HEAP tables: 379K (Tables: 9)
    [!!] InnoDB is enabled but isn't being used
    [!!] ISAM is enabled but isn't being used
    [!!] Total fragmented tables: 215

    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 12d 18h 33m 30s (1B q [1K qps], 185K conn, TX: 3B, RX: 377M)
    [--] Reads / Writes: 78% / 22%
    [--] Total buffers: 2.6M per thread and 58.0M global
    [OK] Maximum possible memory usage: 320.5M (20% of installed RAM)
    [OK] Slow queries: 0% (17/1B)
    [OK] Highest usage of available connections: 32% (32/100)
    [OK] Key buffer size / total MyISAM indexes: 16.0M/72.3M
    [OK] Key buffer hit rate: 99.9%
    [OK] Query cache efficiency: 99.9%
    [!!] Query cache prunes per day: 47549
    [OK] Sorts requiring temporary tables: 0%
    [!!] Temporary tables created on disk: 28%
    [OK] Thread cache hit rate: 99%
    [!!] Table cache hit rate: 0%
    [OK] Open file limit used: 12%
    [OK] Table locks acquired immediately: 99%
    [!!] Connections aborted: 20%

    -------- Recommendations -----------------------------------------------------
    General recommendations:
    Add skip-innodb to MySQL configuration to disable InnoDB
    Add skip-isam to MySQL configuration to disable ISAM
    Run OPTIMIZE TABLE to defragment tables for better performance
    Enable the slow query log to troubleshoot bad queries
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries without LIMIT clauses
    Increase table_cache gradually to avoid file descriptor limits
    Your applications are not closing MySQL connections properly
    Variables to adjust:
    query_cache_size (> 16M)
    tmp_table_size (> 32M)
    max_heap_table_size (> 16M)
    table_cache (> 64)

    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. mohit

    mohit Well-Known Member

    Jul 12, 2005
    Likes Received:
    Trophy Points:
    Sticky On Internet
    I agree with "Thomasc"

    you should run the server for a day or two with normal mysql usage and then use mysql tuner to optimize.

    there's no pre-baked cookies when it comes to mysql optimization.

    a config file working great for one can be a nightmare for the other.
    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