Linux

mysql tuning 스크립트

Naan 2017. 12. 11. 15:30
반응형

스크립트를 실행만 하면 간단하게 mysql 상태를 확인 할 수 있다.

파일을 다운 받아서 서버에 올려서 구동시키면 된다.

파일을 다운 받고

tuning-primer.sh

위 파일을 받자.

# chmod 755 tuning-primer.sh

# ./tuning-primer.sh


        -- MYSQL PERFORMANCE TUNING PRIMER --

             - By: Matthew Montgomery -


MySQL Version 5.6.38-log x86_64


Uptime = 4 days 18 hrs 48 min 58 sec

Avg. qps = 7

Total Questions = 3293156

Threads Connected = 6


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 = 10.000000 sec.

You have 12 out of 3293177 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

Binlog sync is not enabled, you could loose binlog records during a server crash


WORKER THREADS

Current thread_cache_size = 9

Current threads_cached = 7

Current threads_per_sec = 0

Historic threads_per_sec = 0

Your thread_cache_size is fine


MAX CONNECTIONS

Current max_connections = 100

Current threads_connected = 6

Historic max_used_connections = 25

The number of used connections is 25% of the configured maximum.

Your max_connections variable seems to be fine.


INNODB STATUS

Current InnoDB index space = 2.41 G

Current InnoDB data space = 10.05 G

Current InnoDB buffer pool free = 6 %

Current innodb_buffer_pool_size = 2.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 : 3.51 G

Configured Max Per-thread Buffers : 3.95 G

Configured Max Global Buffers : 2.52 G

Configured Max Memory Limit : 6.48 G

Physical Memory : 15.57 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 = 135 K

Current key_buffer_size = 512 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 enabled

Current query_cache_size = 1 M

Current query_cache_used = 16 K

Current query_cache_limit = 1 M

Current Query cache Memory fill ratio = 1.64 %

Current query_cache_min_res_unit = 4 K

Your query_cache_size seems to be too high.

Perhaps you can use these resources elsewhere

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 = 16 M

Sort buffer seems to be fine


JOINS

Current join_buffer_size = 260.00 K

You have had 375 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 = 4110 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 = 2000 tables

Current table_definition_cache = 1400 tables

You have a total of 315 tables

You have 348 open tables.

The table_cache value seems to be fine


TEMP TABLES

Current max_heap_table_size = 16 M

Current tmp_table_size = 512 M

Of 66749 temp tables, 3% 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 = 8 M

Current table scan ratio = 2861 : 1

read_buffer_size seems to be fine


TABLE LOCKING

Current Lock Wait ratio = 0 : 3293435

Your table locking seems to be fine





반응형