MySQL パラメータチューニング

よく分からないパラメータ。
チューニングしたくても なかなか手が出せないですよね。
そんな時、改善すべき推奨パラメータを教えてくれるのが、「mysqltuner」

① ダウンロード
MySQLTunerを下記から取得

http://mysqltuner.com/

② 実行
perl ./mysqltuner.pl

mysqltunerの実行結果の「Recommendations」以降に注目しましょう。

あくまでも改善した方がいいよっていう推奨パラメータ等を教えてくれるものなので
パラメータ値については、ちゃんと考えて設定しましょう。

 

特にメモリ関連のパラメータには注意してください!

※ サーバで使用できるメモリをちゃんと考えて、 設定してましょう!

 

なお、パラメータ修正については、

ご自身において責任をもって

ご判断・ご対応ください。

 

############################################################
mysqltuner.plの実行結果例
############################################################
>> MySQLTuner 1.3.0 – Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with ‘–help’ for additional options and output filtering
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password:
[OK] Currently running supported MySQL version 5.5.34-log
[OK] Operating on 64-bit architecture

——– Storage Engine Statistics ——————————————-
[–] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[–] Data in MyISAM tables: 86M (Tables: 24)
[–] Data in InnoDB tables: 16K (Tables: 1)
[–] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[!!] Total fragmented tables: 6

——– Security Recommendations ——————————————-
[OK] All database users have passwords assigned

——– Performance Metrics ————————————————-
[–] Up for: 12m 20s (105K q [142.505 qps], 3K conn, TX: 642M, RX: 9M)
[–] Reads / Writes: 20% / 80%
[–] Total buffers: 711.0M global + 1.1M per thread (3002 max threads)
[OK] Maximum possible memory usage: 4.0G (6% of installed RAM)
[OK] Slow queries: 0% (0/105K)
[OK] Highest usage of available connections: 27% (829/3002)
[OK] Key buffer size / total MyISAM indexes: 217.0M/4.9M
[!!] Key buffer hit rate: 77.5% (14K cached / 3K reads)
[OK] Query cache efficiency: 98.2% (84K cached / 86K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 21 sorts)
[!!] Joins performed without indexes: 7
[OK] Temporary tables created on disk: 0% (4 on disk / 1K total)
[OK] Thread cache hit rate: 73% (829 created / 3K connections)
[!!] Table cache hit rate: 10% (494 open / 4K opened)
[OK] Open file limit used: 3% (498/15K)
[!!] Table locks acquired immediately: 26%
[OK] InnoDB buffer pool / data size: 435.0M/16.0K
[OK] InnoDB log waits: 0
——– Recommendations —————————————————–
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours – recommendations may be inaccurate
Adjust your join queries to always utilize indexes
Increase table_cache gradually to avoid file descriptor limits
Read this before increasing table_cache over 64: http://bit.ly/1mi7c4C
Optimize queries and/or use InnoDB to reduce lock wait
Variables to adjust:
join_buffer_size (> 128.0K, or always use indexes with joins)
table_cache (> 456)
############################################################

投稿者プロフィール

ito
プログラマー、DBエンジニアを経て、2013年9月よりスカイアーチネットワークスに在籍しております。

現在、サーバ・ネットワークいろいろと奮闘中です。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

Time limit is exhausted. Please reload CAPTCHA.

ABOUTこの記事をかいた人

プログラマー、DBエンジニアを経て、2013年9月よりスカイアーチネットワークスに在籍しております。 現在、サーバ・ネットワークいろいろと奮闘中です。