mysql效能最佳化之Tuning-primer.sh的使用

來源:互聯網
上載者:User

標籤:mysql   效能最佳化   tuning-primer.sh   


Tuning-primer.sh  檢測mysql當前的運行情況,產生報告,並給出最佳化建議。

下載及使用:
1.wget http://www.day32.com/MySQL/tuning-primer.sh

2.將tuning-primer.sh拷貝到my.cnf同級目錄
3.chmod  +xtuning-primer.sh 執行:sh tuning-primer.sh

 

[[email protected] software]#./tuning-primer.sh all

Using login values from ~/.my.cnf

- INITIAL LOGIN ATTEMPT FAILED -

Testing for stored webmin passwords:

 NoneFound

Could not auto detect login info!

Found potential sockets:/home/mysql/data/mysql.sock

Using: /home/mysql/data/mysql.sock

Would you like to provide a differentsocket?: [y/N] n

Do you have your login handy ? [y/N] : y

User: root

Password: [email protected]

 

Would you like me to create a ~/.my.cnffile for you? [y/N] : n

 

       -- MYSQL PERFORMANCE TUNING PRIMER --

            - By: Matthew Montgomery -

 

MySQL Version 5.5.17-log x86_64

 

Uptime = 5 days 18 hrs 32 min 31 sec

Avg. qps = 0

Total Questions = 106649

Threads Connected = 1

 

Server has been running for over 48hrs.

It should be safe to follow theserecommendations

 

To find out more information on how each ofthese

runtime variables effects performancevisit:

http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html

Visithttp://www.mysql.com/products/enterprise/advisors.html

for info about MySQL‘s EnterpriseMonitoring and Advisory Service

# 慢查詢檢查

SLOW QUERIES

The slow query log is enabled.

Current long_query_time = 3.000000 sec.

You have 0 out of 106670 that take longerthan 3.000000 sec. to complete

Your long_query_time seems to be fine

#二進位日誌檢查

BINARY UPDATE LOG

The binary update log is enabled

# 背景工作執行緒檢查

WORKER THREADS

Current thread_cache_size = 64

Current threads_cached = 4

Current threads_per_sec = 0

Historic threads_per_sec = 0

Your thread_cache_size is fine

# 連結檢查

MAX CONNECTIONS

Current max_connections = 2000

Current threads_connected = 1

Historic max_used_connections = 5

The number of used connections is 0% of theconfigured maximum.

You are using less than 10% of yourconfigured max_connections.

Lowering max_connections could help toavoid an over-allocation of memory

See "MEMORY USAGE" section tomake sure you are not over-allocating

# innodb狀態檢查

INNODB STATUS

Current InnoDB index space = 80 K

Current InnoDB data space = 224 K

Current InnoDB buffer pool free = 99 %

Current innodb_buffer_pool_size = 4.00 G

Depending on how much space your innodbindexes take up it may be safe

to increase this value to up to 2 / 3 oftotal system memory

# 記憶體狀態檢查

MEMORY USAGE

Max Memory Ever Allocated : 4.30 G

Configured Max Per-thread Buffers : 4.21 G

Configured Max Global Buffers : 4.29 G

Configured Max Memory Limit : 8.50 G

Physical Memory : 7.68 G

 

Max memory limit exceeds 90% of physicalmemory

# myisam 索引值狀態檢查

KEY BUFFER

Current MyISAM index space = 105 K

Current key_buffer_size = 256 M

Key cache miss rate is 1 : 2

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

Current read_rnd_buffer_size = 512 K

Sort buffer seems to be fine

# 錶鏈接檢查

JOINS

Current join_buffer_size = 132.00 K

You have had 0 queries where a join couldnot use an index properly

Your joins seem to be using indexesproperly

# 檔案限制檢查

OPEN FILES LIMIT

Current open_files_limit = 65535 files

The open_files_limit should typically beset to at least 2x-3x

that of table_cache if you have heavyMyISAM usage.

Your open_files_limit value seems to befine

# 變緩衝檢查

TABLE CACHE

Current table_open_cache = 4220 tables

Current table_definition_cache = 400 tables

You have a total of 55 tables

You have 56 open tables.

The table_cache value seems to be fine

# 暫存資料表檢查狀態檢查

TEMP TABLES

Current max_heap_table_size = 16 M

Current tmp_table_size = 16 M

Of 53466 temp tables, 0% were created ondisk

Created disk tmp tables ratio seems fine

# 表掃描檢查

TABLE SCANS

Current read_buffer_size = 256 K

Current table scan ratio = 52589 : 1

You have a high ratio of sequential accessrequests to SELECTs

You may benefit from raisingread_buffer_size and/or improving your use of indexes.

# 表鎖檢查

TABLE LOCKING

Current Lock Wait ratio = 1 : 91130

Your table locking seems to be fine

 

和 mysqltunner.sql  相比 tuning-primer的檢測的更詳細,主要是針對innodb的檢測,

Mysqltunner.sql 不能對innodb進行檢查的。



本文出自 “SQLServer MySQL” 部落格,請務必保留此出處http://dwchaoyue.blog.51cto.com/2826417/1650952

mysql效能最佳化之Tuning-primer.sh的使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.