MySQL tunning help

  • Filter
  • Time
  • Show
Clear All
new posts

  • MySQL tunning help

    Sorry for my bad english.
    I have a Managed VPS server
    2GB Ram
    64-bit CentOS 6, MySQL 5.5 & PHP 5.4
    I run an application that takes an xml and inserts to the database are about 400,000 insertions per hour.
    In the next hour the system drop the database data and inserts again, this happens in the backend
    In the frontend of the website are connected near to 1000 users per hour, and mysql work is minimal.
    My experience with MySQL parameters is very low.
    But I need help tuning my MySQL to make it work better in the backend.
    I show my configuration and the results of mysqltuner.pl and tuning-primer.sh

    # Basic settings
    user = mysql
    datadir = /var/lib/mysql
    socket = /var/lib/mysql/mysql.sock
    # Security settings
    local-infile = 0
    symbolic-links = 0
    # Memory and cache settings
    query_cache_type = 1
    query_cache_size = 98M
    query_cache_limit = 24M
    thread_cache_size = 24
    table_cache =12
    tmp_table_size = 256M
    max_heap_table_size = 48M
    join_buffer_size = 12M
    key_buffer_size = 460M
    max_connections = 200
    wait_timeout = 3600
    # Innodb settings
    innodb_buffer_pool_size = 256M
    innodb_additional_mem_pool_size = 64M
    innodb_log_buffer_size = 3M
    innodb_thread_concurrency = 6
    # Basic safe settings
    log-error = /var/log/mysqld.log
    pid-file = /var/run/mysqld/mysqld.pid
    ### Log slow queries ###
    log-slow-queries = mysqld-slow.log
    # Duration a query must run (in seconds) to get logged
    long_query_time = 1

    >> MySQLTuner 1.2.0 – Major Hayden
    >> 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: 1G (Tables: 304)
    [--] Data in InnoDB tables: 2M (Tables: 173)
    [!!] Total fragmented tables: 191
    ——– Security Recommendations ——————————————-
    [OK] All database users have passwords assigned
    ——– Performance Metrics ————————————————-
    [--] Up for: 21h 8m 26s (5M q [75.629 qps], 41K conn, TX: 1B, RX: 28B)
    [--] Reads / Writes: 0% / 100%
    [--] Total buffers: 929.0M global + 14.6M per thread (200 max threads)
    [!!] Maximum possible memory usage: 3.8G (110% of installed RAM)
    [OK] Slow queries: 0% (12/5M)
    [OK] Highest usage of available connections: 4% (8/200)
    [OK] Key buffer size / total MyISAM indexes: 460.0M/410.3M
    [OK] Key buffer hit rate: 99.4% (64M cached / 372K reads)
    [OK] Query cache efficiency: 93.6% (469K cached / 501K selects)
    [OK] Query cache prunes per day: 0
    [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 1K sorts)
    [!!] Joins performed without indexes: 263
    [OK] Temporary tables created on disk: 22% (1K on disk / 7K total)
    [OK] Thread cache hit rate: 99% (8 created / 41K connections)
    [!!] Table cache hit rate: 0% (12 open / 11K opened)
    [OK] Open file limit used: 2% (24/1K)
    [OK] Table locks acquired immediately: 99% (41K immediate / 41K locks)
    [OK] InnoDB data size / buffer pool: 2.8M/256.0M
    ——– Recommendations —————————————————–
    General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours – recommendations may be inaccurate
    Reduce your overall MySQL memory footprint for system stability
    Enable the slow query log to troubleshoot bad queries
    Adjust your join queries to always utilize indexes
    Increase table_cache gradually to avoid file descriptor limits
    Variables to adjust:
    *** MySQL’s maximum memory usage is dangerously high ***
    *** Add RAM before increasing MySQL buffer variables ***
    join_buffer_size (> 12.0M, or always use indexes with joins)
    table_cache (> 12)

    - By: Matthew Montgomery -
    MySQL Version 5.1.54 x86_64
    Uptime = 0 days 21 hrs 7 min 34 sec
    Avg. qps = 75
    Total Questions = 5753619
    Threads Connected = 2
    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:
    Visit http://www.mysql.com…e/advisors.html
    for info about MySQL’s Enterprise Monitoring and Advisory Service
    The slow query log is NOT enabled.
    Current long_query_time = 10.000000 sec.
    You have 12 out of 5753646 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 http://dev.mysql.com…e-recovery.html
    Current thread_cache_size = 24
    Current threads_cached = 6
    Current threads_per_sec = 0
    Historic threads_per_sec = 0
    Your thread_cache_size is fine
    Current max_connections = 200
    Current threads_connected = 2
    Historic max_used_connections = 8
    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
    Current InnoDB index space = 2 M
    Current InnoDB data space = 2 M
    Current InnoDB buffer pool free = 96 %
    Current innodb_buffer_pool_size = 256 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 : 997 M
    Configured Max Per-thread Buffers : 2.85 G
    Configured Max Global Buffers : 881 M
    Configured Max Memory Limit : 3.71 G
    Physical Memory : 3.42 G
    Max memory limit exceeds 90% of physical memory
    Current MyISAM index space = 410 M
    Current key_buffer_size = 460 M
    Key cache miss rate is 1 : 171
    Key buffer free ratio = 81 %
    Your key_buffer_size seems to be fine
    Query cache is enabled
    Current query_cache_size = 98 M
    Current query_cache_used = 25 M
    Current query_cache_limit = 24 M
    Current Query cache Memory fill ratio = 25.84 %
    Current query_cache_min_res_unit = 4 K
    Your query_cache_size seems to be too high.
    Perhaps you can use these resources elsewhere
    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 = 12.00 M
    You have had 263 queries where a join could not use an index properly
    join_buffer_size >= 4 M
    This is not advised
    You should enable “log-queries-not-using-indexes”
    Then look for non indexed joins in the slow query log.
    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 = 12 tables
    Current table_definition_cache = 256 tables
    You have a total of 500 tables
    You have 12 open tables.
    Current table_cache hit rate is 0%
    , while 100% of your table cache is in use
    You should probably increase your table_cache
    You should probably increase your table_definition_cache value.
    Current max_heap_table_size = 48 M
    Current tmp_table_size = 256 M
    Of 5775 temp tables, 22% were created on disk
    Effective in-memory tmp_table_size is limited to max_heap_table_size.
    Created disk tmp tables ratio seems fine
    Current read_buffer_size = 128 K
    Current table scan ratio = 5654 : 1
    You have a high ratio of sequential access requests to SELECTs
    You may benefit from raising read_buffer_size and/or improving your use of indexes.
    Current Lock Wait ratio = 1 : 6979
    Your table locking seems to be fine