Skip to main content

Mysql Optimization

Comments

3 comments

  • kernow
    As the tuning-primer script says: "[COLOR="#FF0000">Warning: Server has not been running for at least 48hrs. It may not be safe to use these recommendations"
    0
  • scorpio18
    [quote="kernow, post: 1696252">As the tuning-primer script says: "[COLOR="#FF0000">Warning: Server has not been running for at least 48hrs. It may not be safe to use these recommendations"
    tuning-primer info after 48hrs -- MYSQL PERFORMANCE TUNING PRIMER -- - By: Matthew Montgomery - MySQL Version 5.5.38-0ubuntu0.14.04.1-log x86_64 Uptime = 2 days 0 hrs 18 min 37 sec Avg. qps = 9 Total Questions = 1651070 Threads Connected = 68 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: http://dev.mysql.com/doc/refman/5.5/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 enabled. Current long_query_time = 10.000000 sec. You have 1 out of 1651091 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.5/en/point-in-time-recovery.html WORKER THREADS Current thread_cache_size = 384 Current threads_cached = 15 Current threads_per_sec = 0 Historic threads_per_sec = 0 Your thread_cache_size is fine MAX CONNECTIONS Current max_connections = 300 Current threads_connected = 68 Historic max_used_connections = 83 The number of used connections is 27% of the configured maximum. Your max_connections variable seems to be fine. INNODB STATUS Current InnoDB index space = 25 M Current InnoDB data space = 18 M Current InnoDB buffer pool free = 98 % Current innodb_buffer_pool_size = 4.00 G 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 : 4.82 G Configured Max Per-thread Buffers : 1.88 G Configured Max Global Buffers : 4.29 G Configured Max Memory Limit : 6.18 G Physical Memory : 31.47 G Max memory limit seem to be within acceptable norms KEY BUFFER Current MyISAM index space = 138 K Current key_buffer_size = 10 M Key cache miss rate is 1 : 3 Key buffer free ratio = 80 % Your key_buffer_size seems to be fine QUERY CACHE Query cache is enabled Current query_cache_size = 256 M Current query_cache_used = 338 K Current query_cache_limit = 2 M Current Query cache Memory fill ratio = .12 % 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 SORT OPERATIONS Current sort_buffer_size = 2 M Current read_rnd_buffer_size = 128 K Sort buffer seems to be fine JOINS Current join_buffer_size = 4.00 M You have had 3570 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. OPEN FILES LIMIT Current open_files_limit = 20310 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 = 5000 tables Current table_definition_cache = 400 tables You have a total of 138 tables You have 179 open tables. The table_cache value seems to be fine TEMP TABLES Current max_heap_table_size = 16 M Current tmp_table_size = 16 M Of 194879 temp tables, 0% were created on disk Created disk tmp tables ratio seems fine TABLE SCANS Current read_buffer_size = 128 K Current table scan ratio = 594 : 1 read_buffer_size seems to be fine TABLE LOCKING Current Lock Wait ratio = 0 : 1651376 Your table locking seems to be fine
    mysqltuner: >> MySQLTuner 1.3.0 - Major Hayden >> Bug reports, feature requests, and downloads at http://mysqltuner.com/ >> Run with '--help' for additional options and output filtering [OK] Logged in using credentials from debian maintenance account. [OK] Currently running supported MySQL version 5.5.38-0ubuntu0.14.04.1-log [OK] Operating on 64-bit architecture -------- Storage Engine Statistics ------------------------------------------- [--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM [--] Data in MyISAM tables: 172B (Tables: 12) [--] Data in InnoDB tables: 18M (Tables: 85) [--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17) [!!] Total fragmented tables: 85 -------- Security Recommendations ------------------------------------------- [OK] All database users have passwords assigned -------- Performance Metrics ------------------------------------------------- [--] Up for: 2d 0h 20m 32s (1M q [9.496 qps], 86K conn, TX: 763M, RX: 282M) [--] Reads / Writes: 27% / 73% [--] Total buffers: 4.3G global + 6.4M per thread (300 max threads) [OK] Maximum possible memory usage: 6.2G (19% of installed RAM) [OK] Slow queries: 0% (1/1M) [OK] Highest usage of available connections: 27% (83/300) [OK] Key buffer size / total MyISAM indexes: 10.0M/129.0K [!!] Key buffer hit rate: 66.7% (3 cached / 1 reads) [OK] Query cache efficiency: 53.0% (373K cached / 705K selects) [OK] Query cache prunes per day: 0 [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 31K sorts) [!!] Joins performed without indexes: 3572 [OK] Temporary tables created on disk: 0% (664 on disk / 195K total) [OK] Thread cache hit rate: 99% (83 created / 86K connections) [!!] Table cache hit rate: 5% (179 open / 2K opened) [OK] Open file limit used: 0% (73/20K) [OK] Table locks acquired immediately: 100% (1M immediate / 1M locks) [OK] InnoDB buffer pool / data size: 4.0G/18.6M [OK] InnoDB log waits: 0 -------- Recommendations ----------------------------------------------------- General recommendations: Run OPTIMIZE TABLE to defragment tables for better performance Adjust your join queries to always utilize indexes Increase table_open_cache gradually to avoid file descriptor limits Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C Variables to adjust: join_buffer_size (> 4.0M, or always use indexes with joins) table_open_cache (> 5000)
    0
  • cPanelMichael
    Hello :) Are there any issues with MySQL overall (e.g. running slow)? Or, are you simply trying to improve it's speed as much as possible. You could try modifying the "Variables to adjust" in your /etc/my.cnf file as listed in the output of the tuner script. Thank you.
    0

Please sign in to leave a comment.