tuning-primer.sh性能调试工具的使用

 如果你用show status看mysql的状态,会感觉很难读懂,事实上,你可以用tuing-primer.sh脚本输出可读性的报表,它除了提供报表以外,还进一步提供了修改建议。

对于该工具,安装和使用都非常简单,命令如下:
wget http://www.day32.com/MySQL/tuning-primer.sh
chmod 755 tuning-primer.sh
chown mysql:mysql tuning-primer.sh

直接执行后,下面显示各参数设置报告和修改建议,dba可针对性进行评估后调整。

若mysql的root有设置密码,则需采用prompt模式执行脚本:
-bash-4.1$ ./tuning-primer.sh prompt
Username [anonymous] : root
Password [] :


-bash-4.1$ ./tuning-primer.sh
 
        -- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -

MySQL Version 5.6.24-log x86_64

Uptime = 2 days 21 hrs 52 min 52 sec
Avg. qps = 0
Total Questions = 163
Threads Connected = 2

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.6/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 = 1.000000 sec.
You have 0 out of 184 that take longer than 1.000000 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is enabled
Binlog sync is not enabled, you could loose binlog records during a server crash

WORKER THREADS
Current thread_cache_size = 64
Current threads_cached = 0
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 214
Current threads_connected = 2
Historic max_used_connections = 2
The number of used connections is 0% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See "MEMORY USAGE" section to make sure you are not over-allocating

INNODB STATUS
Current InnoDB index space = 0 bytes
Current InnoDB data space = 240 K
Current InnoDB buffer pool free = 98 %
Current innodb_buffer_pool_size = 256 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 : 350 M
Configured Max Per-thread Buffers : 735 M
Configured Max Global Buffers : 344 M
Configured Max Memory Limit : 1.05 G
Physical Memory : 64.03 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
No key reads?!
Seriously look into using some indexes
Current MyISAM index space = 107 K
Current key_buffer_size = 64 M
Key cache miss rate is 1 : 0
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 = 128 K
Current read_rnd_buffer_size = 1 M
No sort operations have been performed
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
You have had 0 queries where a join could not use an index properly
Your joins seem to be using indexes properly

OPEN FILES LIMIT
Current open_files_limit = 1024 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 = 400 tables
Current table_definition_cache = 4096 tables
You have a total of 90 tables
You have 90 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 64 M
Current tmp_table_size = 32 M
Of 336 temp tables, 10% were created on disk
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 1 M
Current table scan ratio = 4 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 0 : 442
Your table locking seems to be fine

你可能感兴趣的:(mysql性能优化)