MySQL 优化工具 MySQLTuner
http://www.21andy.com/blog/20100414/1864.html
test@phptest:~$ perl ./mysqltuner.pl
>> MySQLTuner 1.2.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:
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.54-1ubuntu4
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 743K (Tables: 106)
[--] Data in InnoDB tables: 154M (Tables: 15)
[!!] Total fragmented tables: 15
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
-------- Performance Metrics -------------------------------------------------
[--] Up for: 6d 16h 35m 58s (2M q [5.031 qps], 816 conn, TX: 1B, RX: 646M)
[--] Reads / Writes: 40% / 60%
[--] Total buffers: 58.0M global + 2.7M per thread (151 max threads)
[OK] Maximum possible memory usage: 463.8M (5% of installed RAM)
[OK] Slow queries: 0% (5K/2M)
[OK] Highest usage of available connections: 18% (28/151)
[OK] Key buffer size / total MyISAM indexes: 16.0M/312.0K
[!!] Key buffer hit rate: 94.7% (19 cached / 1 reads)
[OK] Query cache efficiency: 26.2% (189K cached / 722K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 92K sorts)
[OK] Temporary tables created on disk: 0% (502 on disk / 351K total)
[OK] Thread cache hit rate: 92% (63 created / 816 connections)
[!!] Table cache hit rate: 3% (64 open / 1K opened)
[OK] Open file limit used: 0% (10/1K)
[OK] Table locks acquired immediately: 100% (1M immediate / 1M locks)
[!!] InnoDB data size / buffer pool: 154.2M/8.0M
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Enable the slow query log to troubleshoot bad queries
Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
table_cache (> 64)
innodb_buffer_pool_size (>= 154M)