Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Member
    Join Date
    Jun 2006
    Posts
    21

    Default mysql question - query_cache_size > 512M

    Ok I am not sure where to go from here. It says I should increase the query_cache_size over 512 but then states it might do worse if over 128M. Any ideas? Here is all my info.

    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.1.54
    [OK] Operating on 64-bit architecture
    
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
    [--] Data in MyISAM tables: 439M (Tables: 333)
    [--] Data in InnoDB tables: 457M (Tables: 30)
    [--] Data in MEMORY tables: 0B (Tables: 1)
    [!!] Total fragmented tables: 52
    
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 1d 19h 38m 26s (43M q [274.977 qps], 3M conn, TX: 50B, RX: 4B)
    [--] Reads / Writes: 82% / 18%
    [--] Total buffers: 1.9G global + 2.7M per thread (2000 max threads)
    [OK] Maximum possible memory usage: 7.2G (46% of installed RAM)
    [OK] Slow queries: 0% (67/43M)
    [OK] Highest usage of available connections: 24% (494/2000)
    [OK] Key buffer size / total MyISAM indexes: 128.0M/172.5M
    [OK] Key buffer hit rate: 99.5% (24M cached / 124K reads)
    [OK] Query cache efficiency: 86.4% (28M cached / 33M selects)
    [!!] Query cache prunes per day: 426908
    [OK] Sorts requiring temporary tables: 0% (55 temp sorts / 558K sorts)
    [!!] Temporary tables created on disk: 34% (94K on disk / 272K total)
    [OK] Thread cache hit rate: 98% (55K created / 3M connections)
    [!!] Table cache hit rate: 17% (736 open / 4K opened)
    [OK] Open file limit used: 9% (991/10K)
    [OK] Table locks acquired immediately: 99% (5M immediate / 5M locks)
    [OK] InnoDB data size / buffer pool: 457.5M/1000.0M
    
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Run OPTIMIZE TABLE to defragment tables for better performance
        Enable the slow query log to troubleshoot bad queries
        Increasing the query_cache size over 128M may reduce performance
        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:
        query_cache_size (> 512M) [see warning above]
        table_cache (> 2048)
    my.cnf
    Code:
    [mysqld]
    max_connections=2000
    
    key_buffer_size=128M
    table_cache=2048
    thread_cache=12
    
    query_cache_size=512M
    
    tmp_table_size=256M
    max_heap_table_size=256M
    
    query_cache_min_res_unit=1024
    table_definition_cache=400
    wait_timeout=60
    thread_cache_size=30
    
    innodb_buffer_pool_size=1000M
    Here is what tuning-primer says

    Code:
            -- MYSQL PERFORMANCE TUNING PRIMER --
                 - By: Matthew Montgomery -
    
    MySQL Version 5.1.54 x86_64
    
    Uptime = 1 days 19 hrs 42 min 31 sec
    Avg. qps = 274
    Total Questions = 43264050
    Threads Connected = 10
    
    Warning: Server has not been running for at least 48hrs.
    It may not be safe to use these recommendations
    
    To find out more information on how each of these
    runtime variables effects performance visit:
    http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html
    Visit http://www.mysql.com/products/enterprise/advisors.html
    for info about MySQL's Enterprise Monitoring and Advisory Service
    
    SLOW QUERIES
    The slow query log is NOT enabled.
    Current long_query_time = 10.000000 sec.
    You have 67 out of 43264429 that take longer than 10.000000 sec. to complete
    Your long_query_time seems to be fine
    
    BINARY UPDATE LOG
    The binary update log is NOT enabled.
    You will not be able to do point in time recovery
    See http://dev.mysql.com/doc/refman/5.1/en/point-in-time-recovery.html
    
    WORKER THREADS
    Current thread_cache_size = 30
    Current threads_cached = 29
    Current threads_per_sec = 0
    Historic threads_per_sec = 0
    Your thread_cache_size is fine
    
    MAX CONNECTIONS
    Current max_connections = 2000
    Current threads_connected = 3
    Historic max_used_connections = 494
    The number of used connections is 24% of the configured maximum.
    Your max_connections variable seems to be fine.
    
    INNODB STATUS
    Current InnoDB index space = 214 M
    Current InnoDB data space = 457 M
    Current InnoDB buffer pool free = 35 %
    Current innodb_buffer_pool_size = 1000 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
    
    MEMORY USAGE
    Max Memory Ever Allocated : 2.93 G
    Configured Max Per-thread Buffers : 5.37 G
    Configured Max Global Buffers : 1.60 G
    Configured Max Memory Limit : 6.97 G
    Physical Memory : 15.67 G
    Max memory limit seem to be within acceptable norms
    
    KEY BUFFER
    Current MyISAM index space = 172 M
    Current key_buffer_size = 128 M
    Key cache miss rate is 1 : 200
    Key buffer free ratio = 70 %
    Your key_buffer_size seems to be fine
    
    QUERY CACHE
    Query cache is enabled
    Current query_cache_size = 512 M
    Current query_cache_used = 453 M
    Current query_cache_limit = 1 M
    Current Query cache Memory fill ratio = 88.55 %
    Current query_cache_min_res_unit = 1 K
    However, 777744 queries have been removed from the query cache due to lack of memory
    Perhaps you should raise query_cache_size
    MySQL won't cache query results that are larger than query_cache_limit in size
    
    SORT OPERATIONS
    Current sort_buffer_size = 2 M
    Current read_rnd_buffer_size = 256 K
    Sort buffer seems to be fine
    
    JOINS
    Current join_buffer_size = 132.00 K
    You have had 8 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.
    
    OPEN FILES LIMIT
    Current open_files_limit = 10000 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
    
    TABLE CACHE
    Current table_open_cache = 2048 tables
    Current table_definition_cache = 400 tables
    You have a total of 387 tables
    You have 736 open tables.
    The table_cache value seems to be fine
    
    TEMP TABLES
    Current max_heap_table_size = 256 M
    Current tmp_table_size = 256 M
    Of 178551 temp tables, 34% 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.
    
    TABLE SCANS
    Current read_buffer_size = 128 K
    Current table scan ratio = 91 : 1
    read_buffer_size seems to be fine
    
    TABLE LOCKING
    Current Lock Wait ratio = 1 : 53981
    Your table locking seems to be fine

  2. #2
    Member
    Join Date
    Jan 2011
    Posts
    505
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: mysql question - query_cache_size > 512M

    Hello,

    Your my.cnf is having the below given value.

    query_cache_size=512M

    This is the reason why you received the warning. It is better you reset it to 128M.

  3. #3
    Member
    Join Date
    Jun 2006
    Posts
    21

    Default Re: mysql question - query_cache_size > 512M

    Ok thanks. cPtechie. After I change that back. Should I just ignore the message to increase the query_cache_size?

  4. #4
    Member
    Join Date
    Jan 2011
    Posts
    505
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: mysql question - query_cache_size > 512M

    Hello,

    After editing my.cnf please make sure to restart mysql service. After 24 - 48 hours please re - run the tuner and paste the results here. So that I can guide you on that.

  5. #5
    Member
    Join Date
    Jun 2006
    Posts
    21

    Default Re: mysql question - query_cache_size > 512M

    will do... just made the change and it's live. eventually I will not need help. until then I appreciate it!

  6. #6
    Member
    Join Date
    Jan 2011
    Posts
    505
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: mysql question - query_cache_size > 512M

    Hello,

    Okay! Thank you :-)

  7. #7
    Member
    Join Date
    Jun 2006
    Posts
    21

    Default Re: mysql question - query_cache_size > 512M

    Here is the latest and greatest.

    >> MySQLTuner 1.1.2 - Major Hayden <major@mhtx.net>
    >> Bug reports, feature requests, and downloads at MySQLTuner
    >> 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.54
    [OK] Operating on 64-bit architecture

    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
    [--] Data in MyISAM tables: 424M (Tables: 333)
    [--] Data in InnoDB tables: 460M (Tables: 30)
    [--] Data in MEMORY tables: 0B (Tables: 1)
    [!!] Total fragmented tables: 53

    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 2d 23h 28m 54s (66M q [259.621 qps], 6M conn, TX: 69B, RX: 6B)
    [--] Reads / Writes: 85% / 15%
    [--] Total buffers: 1.5G global + 2.7M per thread (2000 max threads)
    [OK] Maximum possible memory usage: 6.8G (43% of installed RAM)
    [OK] Slow queries: 0% (3/66M)
    [OK] Highest usage of available connections: 4% (98/2000)
    [OK] Key buffer size / total MyISAM indexes: 128.0M/166.4M
    [OK] Key buffer hit rate: 99.6% (44M cached / 182K reads)
    [OK] Query cache efficiency: 86.3% (44M cached / 51M selects)
    [!!] Query cache prunes per day: 1275053
    [OK] Sorts requiring temporary tables: 0% (54 temp sorts / 1M sorts)
    [!!] Temporary tables created on disk: 33% (124K on disk / 375K total)
    [OK] Thread cache hit rate: 98% (76K created / 6M connections)
    [OK] Table cache hit rate: 67% (663 open / 979 opened)
    [OK] Open file limit used: 9% (942/10K)
    [OK] Table locks acquired immediately: 99% (8M immediate / 8M locks)
    [OK] InnoDB data size / buffer pool: 460.5M/1000.0M

    -------- Recommendations -----------------------------------------------------
    General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    Enable the slow query log to troubleshoot bad queries
    Temporary table size is already large - reduce result set size
    Reduce your SELECT DISTINCT queries without LIMIT clauses
    Variables to adjust:
    query_cache_size (> 128M)
    -- MYSQL PERFORMANCE TUNING PRIMER --
    - By: Matthew Montgomery -

    MySQL Version 5.1.54 x86_64

    Uptime = 3 days 0 hrs 31 min 15 sec
    Avg. qps = 260
    Total Questions = 67976587
    Threads Connected = 4

    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:
    MySQL :: MySQL 5.1 Reference Manual :: 5.1.4 Server System Variables
    Visit MySQL :: MySQL Enterprise Advisors
    for info about MySQL's Enterprise Monitoring and Advisory Service

    SLOW QUERIES
    The slow query log is NOT enabled.
    Current long_query_time = 10.000000 sec.
    You have 3 out of 67976608 that take longer than 10.000000 sec. to complete
    Your long_query_time seems to be fine

    BINARY UPDATE LOG
    The binary update log is NOT enabled.
    You will not be able to do point in time recovery
    See MySQL :: MySQL 5.1 Reference Manual :: 6.5 Point-in-Time (Incremental) Recovery Using the Binary Log

    WORKER THREADS
    Current thread_cache_size = 30
    Current threads_cached = 28
    Current threads_per_sec = 0
    Historic threads_per_sec = 0
    Your thread_cache_size is fine

    MAX CONNECTIONS
    Current max_connections = 2000
    Current threads_connected = 4
    Historic max_used_connections = 98
    The number of used connections is 4% 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

    INNODB STATUS
    Current InnoDB index space = 216 M
    Current InnoDB data space = 460 M
    Current InnoDB buffer pool free = 34 %
    Current innodb_buffer_pool_size = 1000 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

    MEMORY USAGE
    Max Memory Ever Allocated : 1.49 G
    Configured Max Per-thread Buffers : 5.37 G
    Configured Max Global Buffers : 1.22 G
    Configured Max Memory Limit : 6.59 G
    Physical Memory : 15.67 G
    Max memory limit seem to be within acceptable norms

    KEY BUFFER
    Current MyISAM index space = 166 M
    Current key_buffer_size = 128 M
    Key cache miss rate is 1 : 244
    Key buffer free ratio = 68 %
    Your key_buffer_size seems to be fine

    QUERY CACHE
    Query cache is enabled
    Current query_cache_size = 128 M
    Current query_cache_used = 80 M
    Current query_cache_limit = 1 M
    Current Query cache Memory fill ratio = 62.88 %
    Current query_cache_min_res_unit = 1 K
    Query Cache is 21 % fragmented
    Run "FLUSH QUERY CACHE" periodically to defragment the query cache memory
    If you have many small queries lower 'query_cache_min_res_unit' to reduce fragmentation.
    MySQL won't cache query results that are larger than query_cache_limit in size

    SORT OPERATIONS
    Current sort_buffer_size = 2 M
    Current read_rnd_buffer_size = 256 K
    Sort buffer seems to be fine

    JOINS
    Current join_buffer_size = 132.00 K
    You have had 17 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.

    OPEN FILES LIMIT
    Current open_files_limit = 10000 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

    TABLE CACHE
    Current table_open_cache = 2048 tables
    Current table_definition_cache = 400 tables
    You have a total of 387 tables
    You have 687 open tables.
    The table_cache value seems to be fine

    TEMP TABLES
    Current max_heap_table_size = 256 M
    Current tmp_table_size = 256 M
    Of 253782 temp tables, 33% 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.

    TABLE SCANS
    Current read_buffer_size = 128 K
    Current table scan ratio = 77 : 1
    read_buffer_size seems to be fine

    TABLE LOCKING
    Current Lock Wait ratio = 1 : 81477
    Your table locking seems to be fine
    [mysqld]
    max_connections=2000

    key_buffer_size=128M
    table_cache=2048
    thread_cache=12

    query_cache_size=128M

    tmp_table_size=256M
    max_heap_table_size=256M

    query_cache_min_res_unit=1024
    table_definition_cache=400
    wait_timeout=60
    thread_cache_size=30

    innodb_buffer_pool_size=1000M

  8. #8
    Member
    Join Date
    Jan 2011
    Posts
    505
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: mysql question - query_cache_size > 512M

    Hello,

    I thinks you can increase the query_cache_size to 256M.

    I have also noted some recommendations.

    >> Run "FLUSH QUERY CACHE" periodically to defragment the query cache memory,
    >> The number of used connections is 4% of the configured maximum. Lowering max_connections could help to avoid an over-allocation of memory. You are using less than 10% of your configured max_connections. So you can also lower the max_connections=2000 to 200.

    Let me know if you need any other clarifications.

  9. #9
    Member
    Join Date
    Aug 2008
    Location
    India
    Posts
    210

    Default Re: mysql question - query_cache_size > 512M

    can i know how can we do "flush query cache" ??

  10. #10
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: mysql question - query_cache_size > 512M

    You can run the command in root SSH mysql command line. Simply log into SSH, then enter these commands:

    Code:
    mysql
    flush query cache;
    You can also use "flush tables;" or "reset query cache;" to clear the queries in the cache. Here's a discussion on these commands:

    MySQL :: MySQL 5.0 Reference Manual :: 7.6.3.4 Query Cache Status and Maintenance
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads & Tags
Similar threads

  1. MySQL query_cache_size = 0 after WHM Upgrade
    By yoachan in forum cPanel and WHM Discussions
    Replies: 13
    Last Post: 08-12-2011, 01:20 AM
  2. MySQL Question
    By jakeruston in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 07-31-2008, 03:26 AM
  3. MySQL 4.1 question
    By drsprite in forum cPanel and WHM Discussions
    Replies: 7
    Last Post: 02-02-2006, 04:14 PM
  4. Yet another MySql question
    By Networkologist in forum cPanel and WHM Discussions
    Replies: 9
    Last Post: 02-16-2003, 05:12 PM
  5. Mysql Question
    By Jedito in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 05-05-2002, 04:49 AM
Tags for this Thread
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube