Mysql Optimization

Discussion in 'Server Operation' started by scramucho, Apr 28, 2011.

  1. scramucho

    scramucho New Member


    I have already optimized my Mysql server and i need to optimize it again.

    Here some statistics, can you help me?

    * tuning-primer:

    - By: Matthew Montgomery -

    MySQL Version 5.1.52-log x86_64

    Uptime = 7 days 23 hrs 27 min 39 sec
    Avg. qps = 164
    Total Questions = 113090093
    Threads Connected = 25

    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 = 1.000000 sec.
    You have 10728 out of 113090169 that take longer than 1.000000 sec. to complete
    Your long_query_time seems to be fine

    The binary update log is enabled
    Binlog sync is not enabled, you could loose binlog records during a server crash

    Current thread_cache_size = 10
    Current threads_cached = 8
    Current threads_per_sec = 0
    Historic threads_per_sec = 0
    Your thread_cache_size is fine

    Current max_connections = 450
    Current threads_connected = 25
    Historic max_used_connections = 144
    The number of used connections is 32% of the configured maximum.
    Your max_connections variable seems to be fine.

    Current InnoDB index space = 26 M
    Current InnoDB data space = 78 M
    Current InnoDB buffer pool free = 0 %
    Current innodb_buffer_pool_size = 128 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.27 G
    Configured Max Per-thread Buffers : 3.63 G
    Configured Max Global Buffers : 1.11 G
    Configured Max Memory Limit : 4.75 G
    Physical Memory : 11.73 G
    Max memory limit seem to be within acceptable norms

    Current MyISAM index space = 15 M
    Current key_buffer_size = 1000 M
    Key cache miss rate is 1 : 1565
    Key buffer free ratio = 81 %
    Your key_buffer_size seems to be fine

    Query cache is enabled
    Current query_cache_size = 8 M
    Current query_cache_used = 4 M
    Current query_cache_limit = 2 M
    Current Query cache Memory fill ratio = 60.70 %
    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 = 2 M
    Sort buffer seems to be fine

    Current join_buffer_size = 2.00 M
    You have had 4 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 = 1024 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 = 282 tables
    Current table_definition_cache = 256 tables
    You have a total of 103 tables
    You have 241 open tables.
    The table_cache value seems to be fine

    Current max_heap_table_size = 16 M
    Current tmp_table_size = 16 M
    Of 373577 temp tables, 25% 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 = 2 M
    Current table scan ratio = 5 : 1
    read_buffer_size seems to be fine

    Current Lock Wait ratio = 1 : 13826
    Your table locking seems to be fine

    * mysqtuner:

    >> MySQLTuner 1.2.0 - Major Hayden <[email protected]>
    >> 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.52-log
    [OK] Operating on 64-bit architecture

    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
    [--] Data in MyISAM tables: 49G (Tables: 49)
    [--] Data in InnoDB tables: 78M (Tables: 31)
    [!!] Total fragmented tables: 32

    -------- Security Recommendations -------------------------------------------
    [!!] User '@localhost' has no password set.

    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 7d 23h 28m 24s (113M q [164.073 qps], 131K conn, TX: 37B, RX: 24B)
    [--] Reads / Writes: 58% / 42%
    [--] Total buffers: 1.1G global + 8.2M per thread (450 max threads)
    [OK] Maximum possible memory usage: 4.8G (40% of installed RAM)
    [OK] Slow queries: 0% (10K/113M)
    [OK] Highest usage of available connections: 32% (144/450)
    [OK] Key buffer size / total MyISAM indexes: 1000.0M/15.5M
    [OK] Key buffer hit rate: 99.9% (9M cached / 6K reads)
    [OK] Query cache efficiency: 27.5% (8M cached / 31M selects)
    [!!] Query cache prunes per day: 206921
    [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 372K sorts)
    [OK] Temporary tables created on disk: 25% (125K on disk / 499K total)
    [OK] Thread cache hit rate: 99% (601 created / 131K connections)
    [!!] Table cache hit rate: 6% (241 open / 3K opened)
    [OK] Open file limit used: 16% (169/1K)
    [OK] Table locks acquired immediately: 99% (56M immediate / 56M locks)
    [OK] InnoDB data size / buffer pool: 78.1M/128.0M

    -------- Recommendations -----------------------------------------------------
    General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    Increase table_cache gradually to avoid file descriptor limits
    Variables to adjust:
    query_cache_size (> 8M)
    table_cache (> 282)

    * memory with free -m:

    total used free shared buffers cached
    Mem: 12011 11942 69 0 438 8248
    -/+ buffers/cache: 3254 8757
    Swap: 1027 0 1027

    * mysqladmin:

    Uptime: 689331 Threads: 25 Questions: 113098989 Slow queries: 10729 Opens: 3636 Flush tables: 1 Open tables: 241 Queries per second avg: 164.70

    I used InnoDB and MyISAM databases, thanks !!!

Share This Page