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.

mysqltuner vs. tuning_primer report

Discussion in 'Workarounds and Optimization' started by Bulent Tekcan, Dec 11, 2011.

  1. Bulent Tekcan

    Bulent Tekcan Well-Known Member

    May 11, 2004
    Likes Received:
    Trophy Points:
    Any idea which one is the correct result ? Because I got 2 different result,and any idea for optimization settings ?

    This is from mysqltuner

                 - By: Matthew Montgomery -
    MySQL Version 5.1.56-log x86_64
    Uptime = 4 days 13 hrs 59 min 2 sec
    Avg. qps = 97
    Total Questions = 38699854
    Threads Connected = 3
    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:
    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 475 out of 38699877 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
    Current thread_cache_size = 512
    Current threads_cached = 125
    Current threads_per_sec = 0
    Historic threads_per_sec = 0
    Your thread_cache_size is fine
    Current max_connections = 400
    Current threads_connected = 5
    Historic max_used_connections = 130
    The number of used connections is 32% of the configured maximum.
    Your max_connections variable seems to be fine.
    No InnoDB Support Enabled!
    Max Memory Ever Allocated : 2.37 G
    Configured Max Per-thread Buffers : 5.56 G
    Configured Max Global Buffers : 576 M
    Configured Max Memory Limit : 6.12 G
    Physical Memory : 15.56 G
    Max memory limit seem to be within acceptable norms
    Current MyISAM index space = 7.45 G
    Current key_buffer_size = 512 M
    Key cache miss rate is 1 : 2304
    Key buffer free ratio = 0 %
    [COLOR="#FF0000"]You could increase key_buffer_size[/COLOR]
    It is safe to raise this up to 1/4 of total system memory;
    assuming this is a dedicated database server.
    Query cache is enabled
    Current query_cache_size = 64 M
    Current query_cache_used = 34 M
    Current query_cache_limit = 16 M
    Current Query cache Memory fill ratio = 54.40 %
    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 = 8 M
    Sort buffer seems to be fine
    Current join_buffer_size = 2.00 M
    You have had 397 queries where a join could not use an index properly
    You should enable "log-queries-not-using-indexes"
    Then look for non indexed joins in the slow query log.
    If you are unable to optimize your queries you may want to increase your
    join_buffer_size to accommodate larger joins in one pass.
    Note! This script will still suggest raising the join_buffer_size when
    ANY joins not using indexes are found.
    Current open_files_limit = 8192 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 = 3000 tables
    Current table_definition_cache = 2000 tables
    You have a total of 609 tables
    You have 1753 open tables.
    The table_cache value seems to be fine
    Current max_heap_table_size = 128 M
    Current tmp_table_size = 128 M
    Of 228515 temp tables, 4% were created on disk
    Created disk tmp tables ratio seems fine
    Current read_buffer_size = 2 M
    Current table scan ratio = 899 : 1
    read_buffer_size seems to be fine
    Current Lock Wait ratio = 1 : 455
    You may benefit from selective use of InnoDB.
    If you have a high concurrency of inserts on Dynamic row-length tables
    consider setting 'concurrent_insert=2'.

    This is from tuning_primer

     >>  MySQLTuner 1.2.0 - Major Hayden <>
     >>  Bug reports, feature requests, and downloads at
     >>  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.56-log
    [OK] Operating on 64-bit architecture
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +Archive -BDB -Federated -InnoDB -ISAM -NDBCluster
    [--] Data in MyISAM tables: 4G (Tables: 582)
    [--] Data in MEMORY tables: 5M (Tables: 4)
    [COLOR="#FF0000"][!!] Total fragmented tables: 46[/COLOR]
    -------- Security Recommendations  -------------------------------------------
    [!!] User 'eximstats@localhost' has no password set.
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 4d 13h 59m 34s (38M q [97.742 qps], 2M conn, TX: 872B, RX: 12B)
    [--] Reads / Writes: 70% / 30%
    [--] Total buffers: 704.0M global + 14.2M per thread (400 max threads)
    [OK] Maximum possible memory usage: 6.3G (40% of installed RAM)
    [OK] Slow queries: 0% (475/38M)
    [OK] Highest usage of available connections: 32% (130/400)
    [OK] Key buffer size / total MyISAM indexes: 512.0M/7.5G
    [OK] Key buffer hit rate: 100.0% (3B cached / 1M reads)
    [OK] Query cache efficiency: 43.0% (10M cached / 24M selects)
    [COLOR="#FF0000"][!!] Query cache prunes per day: 115551[/COLOR]
    [OK] Sorts requiring temporary tables: 0% (928 temp sorts / 4M sorts)
    [OK] Temporary tables created on disk: 4% (10K on disk / 238K total)
    [OK] Thread cache hit rate: 99% (130 created / 2M connections)
    [OK] Table cache hit rate: 40% (1K open / 4K opened)
    [OK] Open file limit used: 28% (2K/8K)
    [OK] Table locks acquired immediately: 99% (43M immediate / 43M locks)
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Run OPTIMIZE TABLE to defragment tables for better performance
    Variables to adjust:
        [COLOR="#FF0000"]query_cache_size (> 64M)[/COLOR]

    This is my my.cnf

    And my server Total processors: 8
    Vendor: GenuineIntel
    Name : Intel(R) Xeon(R) CPU E5506 @ 2.13GHz
    Speed : 1600.000 MHz
    Cache : 4096 KB

    mysql Ver 14.14 Distrib 5.1.56, for unknown-linux-gnu (x86_64) using readline 5.1

    I didn't see any problem (high load and any other thing) but I have a big vBulletin forum,sometimes 3000-4000 online users and also very high traffic,but why 2 report suggestion not same result ?

    #1 Bulent Tekcan, Dec 11, 2011
    Last edited: Dec 11, 2011
  2. alphawolf50

    alphawolf50 Well-Known Member

    Apr 28, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    They are different results, but they are not conflicting results. Tuning-primer is telling you that it's safe to increase your key_buffer_size, not that you need to. It says this because your key buffer is completely full. However, your hit rate indicates that it is not a problem, which is why mysqltuner makes no mention of it.

    For the query_cache, tuning-primer is only looking at how full the cache is, and assuming that since the cache isn't full everything is fine. Mysqltuner sees that there are Qcache_lowmem_prunes and suggests you increase your query_cache_size. However, Mysqltuner will tell you to increase query_cache_size if there are ANY prunes, so it is a bit aggressive on this for my taste... but in this case you probably would be safe increasing query_cache_size. On the other hand, your query_cache_limit is HUGE for the size of your cache. If you really have queries with 16M resultsets, then it only takes one of these to fill 1/4 of your query cache. That means if you have a lot of queries that are only 4K in size (very common, but your situation may be different), then one 16M result will remove 4096 smaller queries from your query cache. You'd probably increase your query cache efficiency (and performance) by decreasing query_cache_limit to something closer to 2M or smaller, but you'll have to test it to find out.
  3. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Oct 2, 2010
    Likes Received:
    Trophy Points:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You may also want to fix your /etc/my.cnf entries to remove things that are already default and use the proper name for the ones that you do have:

    The changes were the following:

    - removed skip-external-locking under [mysqld] section as it is the default setting
    - removed quick under [mysqldump] as it is the default setting
    - removed entries with # as they are commented out so would be unnecessary
    - changed table_cache to table_open_cache, since you are on MySQL 5.1.56 and the variable name changed to table_open_cache (MySQL :: MySQL 5.1 Reference Manual :: 7.8.2 How MySQL Opens and Closes Tables)
    - changed key_buffer to key_buffer_size
    - changed sort_buffer, read_buffer and write_buffer to sort_buffer_size, read_buffer_size and write_buffer_size

    I suggest making a backup of the file prior to editing it, then revising it. At that point, restart MySQL to ensure it does start up. If it doesn't, please tail the MySQL error log at /var/lib/mysql/hostname.err location (where hostname.err is the hostname of the machine ending in .err) to see if you have any other incorrect variables.

Share This Page