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 Tuning

Discussion in 'Workarounds and Optimization' started by ioannisg, Feb 1, 2013.

  1. ioannisg

    ioannisg Registered

    Feb 1, 2013
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Website Owner
    Hello I new here and I have this problem with my mysql in my server. I have a dedicated server with 8 cpus and 12GB with two SSD hard disks. But I have a very slow site.
    My problems is a very slow query in mysgl :

    which does a lot of joins without indexes.

    root@server [~]# ./
     >>  MySQLTuner 1.2.0 - Major Hayden <>
     >>  Bug reports, feature requests, and downloads at [url][/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.67-cll
    [OK] Operating on 64-bit architecture
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
    [--] Data in MyISAM tables: 483M (Tables: 1584)
    [--] Data in InnoDB tables: 208K (Tables: 13)
    [--] Data in MEMORY tables: 0B (Tables: 1)
    [!!] Total fragmented tables: 14
    -------- Security Recommendations  -------------------------------------------
    [OK] All database users have passwords assigned
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 3d 17h 0m 23s (30M q [96.343 qps], 482K conn, TX: 26B, RX: 9B)
    [--] Reads / Writes: 73% / 27%
    [--] Total buffers: 3.3G global + 18.6M per thread (500 max threads)
    [!!] Maximum possible memory usage: 12.4G (216% of installed RAM)
    [OK] Slow queries: 0% (1/30M)
    [OK] Highest usage of available connections: 10% (51/500)
    [OK] Key buffer size / total MyISAM indexes: 1.0G/236.7M
    [OK] Key buffer hit rate: 99.9% (604M cached / 309K reads)
    [OK] Query cache efficiency: 94.3% (26M cached / 28M selects)
    [!!] Query cache prunes per day: 206296
    [OK] Sorts requiring temporary tables: 0% (82 temp sorts / 764K sorts)
    [!!] Joins performed without indexes: 24054
    [!!] Temporary tables created on disk: 37% (401K on disk / 1M total)
    [OK] Thread cache hit rate: 99% (70 created / 482K connections)
    [!!] Table cache hit rate: 2% (1K open / 44K opened)
    [OK] Open file limit used: 20% (2K/9K)
    [OK] Table locks acquired immediately: 99% (5M immediate / 5M locks)
    [OK] InnoDB data size / buffer pool: 208.0K/8.0M
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Run OPTIMIZE TABLE to defragment tables for better performance
        Reduce your overall MySQL memory footprint for system stability
        Increasing the query_cache size over 128M may reduce performance
        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
        Increase table_cache gradually to avoid file descriptor limits
    Variables to adjust:
      *** MySQL's maximum memory usage is dangerously high ***
      *** Add RAM before increasing MySQL buffer variables ***
        query_cache_size (> 256M) [see warning above]
        join_buffer_size (> 16.0M, or always use indexes with joins)
        table_cache (> 1024)
    root@server [~]# sh ~/
                 - By: Matthew Montgomery -
    MySQL Version 5.1.67-cll x86_64
    Uptime = 3 days 17 hrs 19 min 35 sec
    Avg. qps = 96
    Total Questions = 31173461
    Threads Connected = 1
    Server has been running for over 48hrs.
    It should be safe to follow these recommendations
    To find out more information on how each of these
    runtime variables effects performance visit:
    [url=]MySQL :: MySQL 5.1 Reference Manual :: 5.1.4 Server System Variables[/url]
    Visit [url=]MySQL :: MySQL Enterprise Advisors[/url]
    for info about MySQL's Enterprise Monitoring and Advisory Service
    The slow query log is enabled.
    Current long_query_time = 10.000000 sec.
    You have 1 out of 31173482 that take longer than 10.000000 sec. to complete
    Your long_query_time seems to be fine
    The binary update log is NOT enabled.
    You will not be able to do point in time recovery
    See [url=]MySQL :: MySQL 5.1 Reference Manual :: 7.5 Point-in-Time (Incremental) Recovery Using the Binary Log[/url]
    Current thread_cache_size = 16
    Current threads_cached = 15
    Current threads_per_sec = 0
    Historic threads_per_sec = 0
    Your thread_cache_size is fine
    Current max_connections = 500
    Current threads_connected = 1
    Historic max_used_connections = 51
    The number of used connections is 10% of the configured maximum.
    You are using less than 10% of your configured max_connections.
    Lowering max_connections could help to avoid an over-allocation of memory
    See "MEMORY USAGE" section to make sure you are not over-allocating
    Current InnoDB index space = 240 K
    Current InnoDB data space = 208 K
    Current InnoDB buffer pool free = 82 %
    Current innodb_buffer_pool_size = 8 M
    Depending on how much space your innodb indexes take up it may be safe
    to increase this value to up to 2 / 3 of total system memory
    Max Memory Ever Allocated : 2.18 G
    Configured Max Per-thread Buffers : 9.09 G
    Configured Max Global Buffers : 1.25 G
    Configured Max Memory Limit : 10.35 G
    Physical Memory : 5.70 G
    Max memory limit exceeds 90% of physical memory
    Current MyISAM index space = 236 M
    Current key_buffer_size = 1.00 G
    Key cache miss rate is 1 : 1936
    Key buffer free ratio = 81 %
    Your key_buffer_size seems to be fine
    Query cache is enabled
    Current query_cache_size = 256 M
    Current query_cache_used = 161 M
    Current query_cache_limit = 32 M
    Current Query cache Memory fill ratio = 63.25 %
    Current query_cache_min_res_unit = 4 K
    MySQL won't cache query results that are larger than query_cache_limit in size
    Current sort_buffer_size = 2 M
    Current read_rnd_buffer_size = 256 K
    Sort buffer seems to be fine
    Current join_buffer_size = 16.00 M
    You have had 24069 queries where a join could not use an index properly
    join_buffer_size >= 4 M
    This is not advised
    You should enable "log-queries-not-using-indexes"
    Then look for non indexed joins in the slow query log.
    Current open_files_limit = 9742 files
    The open_files_limit should typically be set to at least 2x-3x
    that of table_cache if you have heavy MyISAM usage.
    Your open_files_limit value seems to be fine
    Current table_open_cache = 1024 tables
    Current table_definition_cache = 256 tables
    You have a total of 1621 tables
    You have 1024 open tables.
    Current table_cache hit rate is 1%
    , while 100% of your table cache is in use
    You should probably increase your table_cache
    You should probably increase your table_definition_cache value.
    Current max_heap_table_size = 2.00 G
    Current tmp_table_size = 2.00 G
    Of 669537 temp tables, 37% were created on disk
    Perhaps you should increase your tmp_table_size and/or max_heap_table_size
    to reduce the number of disk-based temporary tables
    Note! BLOB and TEXT columns are not allow in memory tables.
    If you are using these columns raising these values might not impact your
    ratio of on disk temp tables.
    Current read_buffer_size = 128 K
    Current table scan ratio = 1179 : 1
    read_buffer_size seems to be fine
    Current Lock Wait ratio = 1 : 3308
    You may benefit from selective use of InnoDB.
    If you have long running SELECT's against MyISAM tables and perform
    frequent updates consider setting 'low_priority_updates=1'
    If you have a high concurrency of inserts on Dynamic row-length tables
    consider setting 'concurrent_insert=2'
    Can anyone help me here please?
    I don't know what to do. I am paying for dedicated and I can't use my server's resources.

    Thank you

    p.s. I am sorry for my English

Share This Page