読者です 読者をやめる 読者になる 読者になる

Think Village

日々思ったこと、気づいたことを推敲もなしに気ままに書き綴っています。

MySQLツナ


MySQLTuner - major.io

 

MySQLTuner。これ便利だなー。

下記の様な形式で現在の設定に関することやボトルネック

そして設定のレコメンドまで。。

 

$ perl mysqltuner.pl

>> MySQLTuner 1.3.0 - Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password:
[OK] Currently running supported MySQL version 5.1.73
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +CSV +InnoDB +MRG_MYISAM
[--] Data in MyISAM tables: 4M (Tables: 14)
[--] Data in InnoDB tables: 576K (Tables: 7)
[!!] Total fragmented tables: 12

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

-------- Performance Metrics -------------------------------------------------
[--] Up for: 21d 15h 8m 18s (949K q [0.508 qps], 56K conn, TX: 3B, RX: 93M)
[--] Reads / Writes: 97% / 3%
[--] Total buffers: 34.0M global + 2.7M per thread (151 max threads)
[OK] Maximum possible memory usage: 449.2M (11% of installed RAM)
[OK] Slow queries: 0% (10/949K)
[OK] Highest usage of available connections: 6% (10/151)
[OK] Key buffer size / total MyISAM indexes: 8.0M/442.0K
[OK] Key buffer hit rate: 100.0% (4M cached / 199 reads)
[!!] Query cache is disabled
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 207K sorts)
[!!] Temporary tables created on disk: 56% (26K on disk / 47K total)
[!!] Thread cache is disabled
[OK] Table cache hit rate: 85% (53 open / 62 opened)
[OK] Open file limit used: 5% (61/1K)
[OK] Table locks acquired immediately: 99% (874K immediate / 874K locks)
[!!] Connections aborted: 51%
[OK] InnoDB buffer pool / data size: 8.0M/576.0K
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Enable the slow query log to troubleshoot bad queries
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries without LIMIT clauses
Set thread_cache_size to 4 as a starting value
Your applications are not closing MySQL connections properly
Variables to adjust:
query_cache_size (>= 8M)
tmp_table_size (> 16M)
max_heap_table_size (> 16M)
thread_cache_size (start at 4)