当前位置: 首页 > 工具软件 > takeover.sh > 使用案例 >

mysql 脚本调优_MySQL调优脚本tuning-primer.sh

梁丘赞
2023-12-01

-- MYSQL PERFORMANCE TUNING PRIMER --

- By: Matthew Montgomery -

MySQL Version 5.1.56-community-log x86_64

Uptime = 11 days 22 hrs 38 min 41 sec

Avg. qps = 112

Total Questions = 116587054

Threads Connected = 7

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.1/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 enabled.

Current long_query_time = 10.000000 sec.

You have 49490 out of 116587098 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.1/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 = 16

Current threads_cached = 12

Current threads_per_sec = 0

Historic threads_per_sec = 0

Your thread_cache_size is fine

MAX CONNECTIONS

Current max_connections = 1000

Current threads_connected = 5

Historic max_used_connections = 52

The number of used connections is 5% 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 = 3.21 G

Current InnoDB data space = 3.76 G

Current InnoDB buffer pool free = 0 %

Current innodb_buffer_pool_size = 1.00 G

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 : 7.33 G

Configured Max Per-thread Buffers : 110.53 G

Configured Max Global Buffers : 1.58 G

Configured Max Memory Limit : 112.12 G

Physical Memory : 15.67 G

nMax memory limit exceeds 90% of physical memory

KEY BUFFER

Current MyISAM index space = 4 M

Current key_buffer_size = 64 M

Key cache miss rate is 1 : 162

Key buffer free ratio = 44 %

Your key_buffer_size seems to be too high.

Perhaps you can use these resources elsewhere

QUERY CACHE

Query cache is enabled

Current query_cache_size = 512 M

Current query_cache_used = 180 M

Current query_cache_limit = 2 M

Current Query cache Memory fill ratio = 35.21 %

Current query_cache_min_res_unit = 4 K

MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS

Current sort_buffer_size = 16 M

Current read_rnd_buffer_size = 64 M

Sort buffer seems to be fine

JOINS

Current join_buffer_size = 16.00 M

You have had 126 queries where a join could not use an index properly

join_buffer_size >= 4 M

This is not advised

You should enable "log-queries-not-using-indexes"

Then look for non indexed joins in the slow query log.

OPEN FILES LIMIT

Current open_files_limit = 65535 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 = 4096 tables

Current table_definition_cache = 256 tables

You have a total of 427 tables

You have 840 open tables.

The table_cache value seems to be fine

You should probably increase your table_definition_cache value.

TEMP TABLES

Current max_heap_table_size = 64 M

Current tmp_table_size = 1.00 G

Of 749131 temp tables, 0% were created on disk

Effective in-memory tmp_table_size is limited to max_heap_table_size.

Created disk tmp tables ratio seems fine

TABLE SCANS

Current read_buffer_size = 16 M

Current table scan ratio = 647 : 1

read_buffer_size is over 8 MB there is probably no need for such a large read_buffer

TABLE LOCKING

Current Lock Wait ratio = 1 : 3828971

Your table locking seems to be fine

 类似资料: