17
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MySQL5.5でOLAP用のメモリチューニング例

Last updated at Posted at 2014-06-24

想定する利用状況

物理メモリ16GB
同時接続セッション数は通常1、まれに2
利用はINNODBが中心
テーブルサイズは1GB~5GBが多い

my.cnf

[mysqld]
# global
innodb_buffer_pool_size=12G
max_heap_table_size=1G
tmp_table_size=1G

# session
sort_buffer_size=256M

# disk
innodb_log_file_size=1G

各項目の解説

innodb_buffer_pool_size

一言で言うとread cacheの大きさ。全メモリの70%くらいが良いとされる

innodb_log_file_size

write cacheで、インデックス酷使したINSERTのパフォーマンスに関わる。「MySQLで大量データのインサートが遅い」場合に増やすことを検討する。

http://nippondanji.blogspot.jp/2009/01/innodb.html
http://dsas.blog.klab.org/archives/50860867.html

show engine innodb staus等でinsert速度を調べ、遅い場合にこれを増やす。

sort_buffer_size

ファイルソートの高速化に使われるので多めに。
show processlistでfile sortと表示されている時間が長い場合にこれを増やす

max_heap_table_size, tmp_table_size

テンポラリテーブルに使われる。サブクエリなどで使われるので多めに。
show processlistでwrite to tmpと表示されている時間が長い場合にこれを増やす

まとめ

OLAP用のメモリ設定の例が見当たらなかったため、決定版というより、ここに書いておけば諸先輩方から暖かいご批判をいただけるのではないかと思い、たたき台として書いた次第。sort_buffer_size, max_heap_table_size, tmp_table_sizeあたりは、用途によっては」もうちょっと多くしても良いかもしれない。

17
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?