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 Opmimzation

Discussion in 'Workarounds and Optimization' started by Legin76, Jun 5, 2014.

  1. Legin76

    Legin76 Well-Known Member

    Dec 11, 2007
    Likes Received:
    Trophy Points:

    I've been trying to optimise my server. It has two 2GHz processors and 4gb of ram on CentOS 5.10 with 2.6.18-371.8.1.el5PAE

    I've kept the join_buffer_size at 256K as I read that it was not good to have it to high but set key_buffer_size = 256M to compensate. I also tried to avoid increasing query_cache_size to much but I MySQLTuner still seems to thing I needs more.

    What should I be setting to get the best out of it?

    set-variable = max_connections=500
    set-variable = max_allowed_packet=16M
    query_cache_size = 128M
    query_cache_limit = 16M
    join_buffer_size = 256K
    key_buffer_size = 256M
    thread_cache_size = 16
    table_cache = 64
    innodb_buffer_pool_size = 120M
    innodb_log_buffer_size = 4M

    root@srv04 [~]# perl
     >>  MySQLTuner 1.3.0 - Major Hayden <>
     >>  Bug reports, feature requests, and downloads at
     >>  Run with '--help' for additional options and output filtering
    [OK] Currently running supported MySQL version 5.1.73-cll
    [!!] Switch to 64-bit OS - MySQL cannot currently use all of your RAM
    -------- Storage Engine Statistics -------------------------------------------
    [--] Data in MyISAM tables: 1G (Tables: 2451)
    [--] Data in InnoDB tables: 88M (Tables: 418)
    [--] Data in MEMORY tables: 126K (Tables: 6)
    [!!] Total fragmented tables: 454
    -------- Security Recommendations  -------------------------------------------
    [OK] All database users have passwords assigned
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 1d 15h 17m 1s (8M q [59.379 qps], 159K conn, TX: 15B, RX: 1B)
    [--] Reads / Writes: 76% / 24%
    [--] Total buffers: 525.0M global + 2.8M per thread (500 max threads)
    [OK] Maximum possible memory usage: 1.9G (47% of installed RAM)
    [OK] Slow queries: 0% (67/8M)
    [OK] Highest usage of available connections: 13% (66/500)
    [OK] Key buffer size / total MyISAM indexes: 256.0M/210.3M
    [OK] Key buffer hit rate: 99.0% (102M cached / 1M reads)
    [OK] Query cache efficiency: 75.1% (5M cached / 7M selects)
    [!!] Query cache prunes per day: 434558
    [OK] Sorts requiring temporary tables: 0% (75 temp sorts / 616K sorts)
    [!!] Joins performed without indexes: 1617
    [OK] Temporary tables created on disk: 23% (118K on disk / 510K total)
    [OK] Thread cache hit rate: 99% (102 created / 159K connections)
    [!!] Table cache hit rate: 0% (64 open / 2M opened)
    [OK] Open file limit used: 0% (124/19K)
    [OK] Table locks acquired immediately: 99% (2M immediate / 2M locks)
    [OK] InnoDB buffer pool / data size: 120.0M/88.7M
    [OK] InnoDB log waits: 0
    -------- 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
        Increase table_cache gradually to avoid file descriptor limits
        Read this before increasing table_cache over 64:
    Variables to adjust:
        query_cache_size (> 128M)
        join_buffer_size (> 256.0K, or always use indexes with joins)
        table_cache (> 64)
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    Hello :)

    You could try increasing the values as suggested by the MySQL tuner. However, overall, are you experiencing issues with slowness with MySQL, or are you simply trying to optimize performance as best as possible?

    Thank you.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Legin76

    Legin76 Well-Known Member

    Dec 11, 2007
    Likes Received:
    Trophy Points:

    I had some issues so have increased the ram and set up PAE to get the most out of it.

    Now I'm just trying to get the best possible.

    - - - Updated - - -

    table_cache was getting really high, but when I read the info on it I thought that I may be better off keeping that at 64.

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