SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2011
    0 Post(s)
    0 Thread(s)

    MySQL Server Crashing need Help

    Hi, we have some problem with mysql high cpu , would like some help with MySQL Tuning
    here are the mysqltuner & tuning-primer details
    [root@main src]# mysqltuner

    >> MySQLTuner 1.1.1 - Major Hayden <>
    >> 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: 275M (Tables: 654)
    [--] Data in InnoDB tables: 35M (Tables: 293)
    [!!] Total fragmented tables: 300

    -------- Security Recommendations -------------------------------------------
    [OK] All database users have passwords assigned

    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 10h 19m 57s (631K q [16.981 qps], 39K conn, TX: 3B, RX: 102M)
    [--] Reads / Writes: 97% / 3%
    [--] Total buffers: 906.0M global + 4.6M per thread (500 max threads)
    [OK] Maximum possible memory usage: 3.1G (26% of installed RAM)
    [OK] Slow queries: 0% (106/631K)
    [OK] Highest usage of available connections: 2% (14/500)
    [OK] Key buffer size / total MyISAM indexes: 8.0M/59.4M
    [OK] Key buffer hit rate: 100.0% (12B cached / 317K reads)
    [OK] Query cache efficiency: 68.4% (350K cached / 511K selects)
    [!!] Query cache prunes per day: 166830
    [OK] Sorts requiring temporary tables: 0% (10 temp sorts / 171K sorts)
    [!!] Temporary tables created on disk: 48% (26K on disk / 54K total)
    [OK] Thread cache hit rate: 99% (102 created / 39K connections)
    [!!] Table cache hit rate: 9% (1K open / 10K opened)
    [OK] Open file limit used: 17% (1K/8K)
    [OK] Table locks acquired immediately: 99% (206K immediate / 206K locks)
    [!!] Connections aborted: 28%
    [OK] InnoDB data size / buffer pool: 35.4M/512.0M

    -------- Recommendations -----------------------------------------------------
    General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    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
    Your applications are not closing MySQL connections properly
    Variables to adjust:
    query_cache_size (> 128M)
    table_cache (> 2048)
    - By: Matthew Montgomery -

    MySQL Version 5.1.56-log x86_64

    Uptime = 0 days 10 hrs 17 min 59 sec
    Avg. qps = 16
    Total Questions = 629952
    Threads Connected = 11

    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:
    MySQL :: MySQL 5.1 Reference Manual :: 5.1.3 Server System Variables
    Visit MySQL :: MySQL Enterprise Advisors
    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 105 out of 629973 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 MySQL :: MySQL 5.1 Reference Manual :: 6.5 Point-in-Time (Incremental) Recovery Using the Binary Log

    Current thread_cache_size = 4
    Current threads_cached = 2
    Current threads_per_sec = 0
    Historic threads_per_sec = 0
    Your thread_cache_size is fine

    Current max_connections = 500
    Current threads_connected = 11
    Historic max_used_connections = 14
    The number of used connections is 2% 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 = 2 M
    Current InnoDB data space = 35 M
    Current InnoDB buffer pool free = 0 %
    Current innodb_buffer_pool_size = 512 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 : 714 M
    Configured Max Per-thread Buffers : 2.25 G
    Configured Max Global Buffers : 649 M
    Configured Max Memory Limit : 2.89 G
    Physical Memory : 11.72 G
    Max memory limit seem to be within acceptable norms

    Current MyISAM index space = 59 M
    Current key_buffer_size = 7 M
    Key cache miss rate is 1 : 38354
    Key buffer free ratio = 0 %
    You could increase key_buffer_size
    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 = 128 M
    Current query_cache_used = 113 M
    Current query_cache_limit = 20 M
    Current Query cache Memory fill ratio = 88.81 %
    Current query_cache_min_res_unit = 4 K
    However, 71728 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

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

    Current join_buffer_size = 2.00 M
    You have had 1 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 = 2048 tables
    Current table_definition_cache = 1024 tables
    You have a total of 970 tables
    You have 1012 open tables.
    The table_cache value seems to be fine

    Current max_heap_table_size = 256 M
    Current tmp_table_size = 256 M
    Of 28441 temp tables, 48% 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 = 526 : 1
    read_buffer_size seems to be fine

    Current Lock Wait ratio = 1 : 29379
    Your table locking seems to be fine
    # Default to using old password format for compatibility with mysql 3.x
    # clients (those using the mysqlclient10 compatibility package).
    query_cache_size = 512M
    join_buffer_size = 2M
    thread_cache_size = 4
    table_cache = 4096
    table_definition_cache = 1024
    query_cache_limit = 20M
    long_query_time = 10
    log-slow-queries = /var/log/mysql-slow.log
    tmpdir = /var/lib/mysql/tmp
    max_connections = 500
    max_user_connections = 10
    tmp_table_size = 256M
    max_heap_table_size = 256M
    innodb_buffer_pool_size = 512M
    key_buffer = 16M
    myisam_sort_buffer_size = 32M
    read_buffer_size = 2M
    sort_buffer_size = 2M
    interactive_timeout = 25
    wait_timeout = 1000
    connect_timeout = 10
    max_allowed_packet = 16M
    max_connect_errors = 10
    query_cache_type = 1
    open_files_limit = 8192
    max_allowed_packet = 16M
    key_buffer = 32M
    sort_buffer = 32M
    read_buffer = 16M
    write_buffer = 16M
    interactive-timeout A
    Thank you.

  2. #2
    Join Date
    Apr 2004
    Miami, FL, USA
    0 Post(s)
    0 Thread(s)
    Some preliminary questions:
    Is this a MySQL-only server, or is it also running apache?
    Have you ensured that your tables and queries are optimal?
    Have you ensured that you're properly closing connections in your application?
    Have you installed mytop to monitor query performance yet?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts