脚本源码https://launchpadlibrarian.net/78745738/tuning-primer.sh
http://www.cnblogs.com/zuoxingyu/archive/2013/04/09/3010024.html
环境
my.cnf中[client]需要配置使用的用户,执行show status/variables权限,可以给super
user = myadmin
password = myadmin
输出结果
点击(此处)折叠或打开
- -- MYSQL PERFORMANCE TUNING PRIMER --
- - By: Matthew Montgomery -
- MySQL Version 5.5.19-log x86_64
- Uptime = 23 days 3 hrs 17 min 8 sec
- Avg. qps = 2
- Total Questions = 4543819
- Threads Connected = 10
- 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 NOT enabled.
- Current long_query_time = 10.000000 sec.
- You have 21 out of 4543840 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 enabled
- The expire_logs_days is not set.
- The mysqld will retain the entire binary log until RESET MASTER or PURGE MASTER LOGS commands are run manually
- Setting expire_logs_days will allow you to remove old binary logs automatically
- See http://dev.mysql.com/doc/refman/5.5/en/purge-master-logs.html
- Binlog sync is not enabled, you could loose binlog records during a server crash
- WORKER THREADS
- Current thread_cache_size = 0
- Current threads_cached = 0
- Current threads_per_sec = 1
- Historic threads_per_sec = 0
- Your thread_cache_size is fine
- MAX CONNECTIONS
- Current max_connections = 151
- Current threads_connected = 10
- Historic max_used_connections = 152
- The number of used connections is 100% of the configured maximum.
- You should raise max_connections
- INNODB STATUS
- Current InnoDB index space = 0 bytes
- Current InnoDB data space = 0 bytes
- Current InnoDB buffer pool free = 0 %
- Current innodb_buffer_pool_size = 128 M
- 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 : 411 M
- Configured Max Per-thread Buffers : 250 M
- Configured Max Global Buffers : 160 M
- Configured Max Memory Limit : 410 M
- Physical Memory : 3.73 G
- Max memory limit seem to be within acceptable norms
- KEY BUFFER
- Current MyISAM index space = 9 K
- Current key_buffer_size = 16 M
- Key cache miss rate is 1 : 659
- Key buffer free ratio = 81 %
- Your key_buffer_size seems to be fine
- QUERY CACHE
- Query cache is supported but not enabled
- Perhaps you should set the query_cache_size
- SORT OPERATIONS
- Current sort_buffer_size = 512 K
- Current read_rnd_buffer_size = 512 K
- Sort buffer seems to be fine
- JOINS
- Current join_buffer_size = 132.00 K
- You have had 398 queries where a join could not use an index properly
- You should enable \"log-queries-not-using-indexes\"
- Then look for non indexed joins in the slow query log.
- If you are unable to optimize your queries you may want to increase your
- join_buffer_size to accommodate larger joins in one pass.
- Note! This script will still suggest raising the join_buffer_size when
- ANY joins not using indexes are found.
- OPEN FILES LIMIT
- Current open_files_limit = 60000 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 = 64 tables
- Current table_definition_cache = 400 tables
- You have a total of 0 tables
- You have 64 open tables.
- Current table_cache hit rate is 0%
- , while 100% of your table cache is in use
- You should probably increase your table_cache
- TEMP TABLES
- Current max_heap_table_size = 16 M
- Current tmp_table_size = 16 M
- Of 303828 temp tables, 1% were created on disk
- Created disk tmp tables ratio seems fine
- TABLE SCANS
- Current read_buffer_size = 256 K
- Current table scan ratio = 60 : 1
- read_buffer_size seems to be fine
- TABLE LOCKING
- Current Lock Wait ratio = 1 : 12920
- Your table locking seems to be fine