Tag Archives: Perl

[MySQL]サーバパラメータチューニング

Show Statusでいろいろ見ながら調べながら
やっていたけど便利なものを見つけました。

MySQLTuner-perl

Perlスクリプト1本を実行するだけで、現在の設定についてコメントをくれます。

こんな感じ。
[!!]のところを見直せばOKみたい。
最後にアドバイスもある。

>>  MySQLTuner 0.9.9 - 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:
[--] Assuming 256 MB of physical memory
[--] Assuming 128 MB of swap space

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.27-standard
[OK] Operating on 32-bit architecture with less than 2GB RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 38M (Tables: 1630)
[--] Data in InnoDB tables: 480K (Tables: 9)
[!!] Total fragmented tables: 67

-------- Performance Metrics -------------------------------------------------
[--] Up for: 36m 14s (2K q [1.220 qps], 133 conn, TX: 8M, RX: 769K)
[--] Reads / Writes: 93% / 7%
[--] Total buffers: 34.0M global + 2.7M per thread (100 max threads)
[!!] Maximum possible memory usage: 302.7M (118% of installed RAM)
[OK] Slow queries: 0% (2/2K)
[OK] Highest usage of available connections: 7% (7/100)
[OK] Key buffer size / total MyISAM indexes: 8.0M/23.4M
[OK] Key buffer hit rate: 99.2% (49K cached / 406 reads)
[!!] Query cache is disabled
[OK] Sorts requiring temporary tables: 3% (18 temp sorts / 541 sorts)
[!!] Joins performed without indexes: 13
[!!] Temporary tables created on disk: 31% (133 on disk / 429 total)
[!!] Thread cache is disabled
[!!] Table cache hit rate: 1% (64 open / 5K opened)
[OK] Open file limit used: 12% (127/1K)
[OK] Table locks acquired immediately: 100% (2K immediate / 2K locks)
[OK] InnoDB data size / buffer pool: 480.0K/8.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
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
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
*** MySQL's maximum memory usage exceeds your installed memory ***
*** Add more RAM before increasing any MySQL buffer variables  ***
query_cache_size (>= 8M)
join_buffer_size (> 128.0K, or always use indexes with joins)
tmp_table_size (> 32M)
max_heap_table_size (> 16M)
thread_cache_size (start at 4)
table_cache (> 64)