mysql性能优化脚本mysqltuner.pl
官方站点: http://blog.mysqltuner.com/get-involved/
wget http://mysqltuner.pl/mysqltuner.pl
[root@server63 ~]# perl mysqltuner.pl –socket=/tmp/mysql.sock
>> MySQLTuner 1.0.1 – Major Hayden <>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with ‘–help’ for additional options and output filtering
[!!] Successfully authenticated with no password – SECURITY RISK!
——– General Statistics ————————————————–
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.86-log
[OK] Operating on 64-bit architecture
——– Storage Engine Statistics ——————————————-
[--] Status: -Archive -BDB -Federated -InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 3G (Tables: 255)
[--] Data in MEMORY tables: 2M (Tables: 2)
[!!] Total fragmented tables: 39
——– Performance Metrics ————————————————-
[--] Up for: 15d 16h 8m 16s (338M q [249.647 qps], 25M conn, TX: 1026B, RX: 36B)
[--] Reads / Writes: 84% / 16%
[--] Total buffers: 1.1G global + 12.4M per thread (3000 max threads)
[!!] Maximum possible memory usage: 37.4G (479% of installed RAM)
[OK] Slow queries: 0% (194/338M)
[OK] Highest usage of available connections: 25% (760/3000)
[OK] Key buffer size / total MyISAM indexes: 1.0G/623.0M
[OK] Key buffer hit rate: 100.0% (15B cached / 3M reads)
[OK] Query cache efficiency: 45.0% (96M cached / 214M selects)
[!!] Query cache prunes per day: 585977
[OK] Sorts requiring temporary tables: 0% (68K temp sorts / 17M sorts)
[!!] Joins performed without indexes: 28072
[OK] Temporary tables created on disk: 0% (8K on disk / 5M total)
[OK] Thread cache hit rate: 99% (187K created / 25M connections)
[!!] Table cache hit rate: 1% (512 open / 44K opened)
[OK] Open file limit used: 5% (772/15K)
[OK] Table locks acquired immediately: 99% (180M immediate / 181M locks)
——– Recommendations —————————————————–
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
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 ***
query_cache_size (> 128M)
join_buffer_size (> 128.0K, or always use indexes with joins)
table_cache (> 512)