Results 1 to 10 of 10
  1. #1

    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
    mysqltuner:
    [[email protected] src]# mysqltuner

    >> MySQLTuner 1.1.1 - Major Hayden <[email protected]>
    >> 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)
    tuning-primer
    -- MYSQL PERFORMANCE TUNING PRIMER --
    - 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

    SLOW QUERIES
    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

    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 = 4
    Current threads_cached = 2
    Current threads_per_sec = 0
    Historic threads_per_sec = 0
    Your thread_cache_size is fine

    MAX CONNECTIONS
    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

    INNODB STATUS
    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

    MEMORY USAGE
    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

    KEY BUFFER
    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
    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

    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 = 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.

    OPEN FILES LIMIT
    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

    TABLE CACHE
    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

    TEMP TABLES
    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.

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

    TABLE LOCKING
    Current Lock Wait ratio = 1 : 29379
    Your table locking seems to be fine
    /etc/my.cnf
    [mysqld]
    set-variable=local-infile=0
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    user=mysql
    # Default to using old password format for compatibility with mysql 3.x
    # clients (those using the mysqlclient10 compatibility package).
    old_passwords=1
    query_cache_size = 512M
    join_buffer_size = 2M
    thread_cache_size = 4
    table_cache = 4096
    table_definition_cache = 1024
    query_cache_limit = 20M
    #skip-bdb
    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
    [mysqld_safe]
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    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
    skip-innodb
    [mysqld_safe]
    open_files_limit = 8192
    [mysqldump]
    quick
    max_allowed_packet = 16M
    [myisamchk]
    key_buffer = 32M
    sort_buffer = 32M
    read_buffer = 16M
    write_buffer = 16M
    [mysqlhotcopy]
    interactive-timeout A
    Thank you.

  2. #2
    Join Date
    Nov 2010
    Location
    Arizona
    Posts
    297
    Keep running the tuner until the settings are correct for your server.

  3. #3
    thx for reply

    i did try to fix it using the tuner , but noway , somethign keep crash the mysql server often.

    are the my.cnf setting ok?

  4. #4
    Join Date
    May 2009
    Location
    On a Speck!!!!!
    Posts
    216
    Hello,

    How much RAM are you having in the system? Also how many sites do you have that uses Mysql intensively?
    Regards,
    Tom.

    Freelance System Administrator

  5. #5
    Thex for reply Thomas

    here is what i got using "free -m"

    [[email protected] src]# free -m
    total used free shared buffers cached
    Mem: 12002 4279 7723 0 512 2071
    -/+ buffers/cache: 1694 10307
    Swap: 2047 0 2046
    only one site that use mysql intensively

  6. #6
    Join Date
    Jan 2005
    Location
    Scotland, UK
    Posts
    2,549
    Drop the innodb pool buffer size from 512MB to less than 100MB and increase your key_buffer size.

    Given mySQL was only up for 10 hours you might want to wait for some more info.
    Server Management - AdminGeekZ.com
    Infrastructure Management, Web Application Performance, mySQL DBA. System Automation.
    WordPress/Magento Performance, Apache to Nginx Conversion, Varnish Implimentation, DDoS Protection, Custom Nginx Modules
    Check our wordpress varnish plugin. Contact us for quote: [email protected]

  7. #7
    thx Scott.Mc for reply

    i can't wait because the site crash and i need to reboot mysqld to make it works again...

    my.cnf with new changes:

    [mysqld]
    set-variable=local-infile=0
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    user=mysql
    # Default to using old password format for compatibility with mysql 3.x
    # clients (those using the mysqlclient10 compatibility package).
    old_passwords=1
    query_cache_size = 512M
    join_buffer_size = 2M
    thread_cache_size = 4
    table_cache = 8192
    table_definition_cache = 1024
    query_cache_limit = 20M
    #skip-bdb
    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 = 100M
    [mysqld_safe]
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    key_buffer = 64M
    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
    skip-innodb
    [mysqld_safe]
    open_files_limit = 8192
    [mysqldump]
    quick
    max_allowed_packet = 16M
    [myisamchk]
    key_buffer = 64M
    sort_buffer = 32M
    read_buffer = 16M
    write_buffer = 16M
    [mysqlhotcopy]
    interactive-timeout A
    Last edited by cataplexy; 04-25-2011 at 06:59 AM.

  8. #8
    Join Date
    Jan 2005
    Location
    Scotland, UK
    Posts
    2,549
    You are going to need to specify exactly what happens on the "crash". Does the daemon actually crash or does it just fill with connections. If it's connections you need to see what queries are causing this.
    Server Management - AdminGeekZ.com
    Infrastructure Management, Web Application Performance, mySQL DBA. System Automation.
    WordPress/Magento Performance, Apache to Nginx Conversion, Varnish Implimentation, DDoS Protection, Custom Nginx Modules
    Check our wordpress varnish plugin. Contact us for quote: [email protected]

  9. #9
    using mysql> SHOW processlist;



    i can see many queries like this:

    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND YEAR(wp_posts.post_date)='2009' AND MONTH(wp_posts |
    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND YEAR(wp_posts.post_date)='2011' AND MONTH(wp_posts |
    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND YEAR(wp_posts.post_date)='2008' AND MONTH(wp_posts |
    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND (((wp_posts.post_title LIKE '%n |
    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND YEAR(wp_posts.post_date)='2011' AND MONTH(wp_posts |
    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND (((wp_posts.post_title LIKE '%n |
    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND YEAR(wp_posts.post_date)='2011' AND MONTH(wp_posts |
    SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts. |
    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND YEAR(wp_posts.post_date)='2009' AND MONTH(wp_posts |
    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND YEAR(wp_posts.post_date)='2011' AND MONTH(wp_posts |
    SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND YEAR(wp_posts.post_date)='2011' AND MONTH(wp_posts |

  10. #10
    we get [!!] Connections aborted: 10%


    and the site is down again

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

    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
    [--] Data in MyISAM tables: 284M (Tables: 665)
    [--] Data in InnoDB tables: 35M (Tables: 293)
    [!!] Total fragmented tables: 303

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

    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 23m 4s (32K q [23.181 qps], 2K conn, TX: 179M, RX: 4M)
    [--] Reads / Writes: 97% / 3%
    [--] Total buffers: 1.1G global + 4.6M per thread (800 max threads)
    [OK] Maximum possible memory usage: 4.7G (39% of installed RAM)
    [OK] Slow queries: 0% (2/32K)
    [OK] Highest usage of available connections: 38% (304/800)
    [OK] Key buffer size / total MyISAM indexes: 8.0M/61.5M
    [OK] Key buffer hit rate: 100.0% (327M cached / 20K reads)
    [OK] Query cache efficiency: 66.5% (16K cached / 24K selects)
    [OK] Query cache prunes per day: 0
    [OK] Sorts requiring temporary tables: 2% (80 temp sorts / 2K sorts)
    [!!] Temporary tables created on disk: 47% (1K on disk / 2K total)
    [OK] Thread cache hit rate: 85% (309 created / 2K connections)
    [OK] Table cache hit rate: 98% (452 open / 460 opened)
    [OK] Open file limit used: 2% (500/17K)
    [OK] Table locks acquired immediately: 97% (10K immediate / 10K locks)
    [!!] Connections aborted: 10%
    [OK] InnoDB data size / buffer pool: 35.4M/300.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
    Your applications are not closing MySQL connections properly

Similar Threads

  1. mysql keeps crashing
    By Bluz in forum Hosting Security and Technology
    Replies: 13
    Last Post: 11-21-2009, 05:22 PM
  2. Replies: 17
    Last Post: 09-17-2009, 06:51 PM
  3. New server crashing after some minutes - Mysql ?
    By ZaxiHosting in forum Hosting Security and Technology
    Replies: 11
    Last Post: 01-01-2008, 07:53 PM
  4. Mysql and server load and crashing
    By freemancryin in forum Hosting Security and Technology
    Replies: 4
    Last Post: 06-16-2005, 11:55 PM
  5. Mysql server is crashing everying 5-10 min ..
    By theloophole in forum Hosting Security and Technology
    Replies: 0
    Last Post: 08-09-2004, 07:01 PM

Posting Permissions

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