(ç¹ã«MyISAMã使ã£ã¦ãã)ã¦ã§ãå±ãããInnoDBã使ãå ´åã®è¨å®é ç®
InnoDBã¯MyISAMã¨æ¯è¼ãã¦å®å ¨(OSã¯ã©ãã·ã¥ãé»æºæãçºçãã¦ããã¼ãã«ãå£ããªã)åãæ¸ãè¾¼ã¿ãé ãããã¼ã¿ãã¼ã¹å±ããããããã¨ãããã¯å½ç¶ã®ãã¨ã§MyISAMããããããã ãã¨ãããã¨ã«ãªããã ããããããªããã¯ã¢ããæ©è½ã®ã¤ããRAIDã«ã¼ãã使ããã ãã¨ãã話ã«ãªããã§ããMyISAMã使ã£ã¦ããã¦ã§ãå±ããã®ç¾å ´ã§ã¯ãå ´åã«ãã£ã¦å¤å°ãã¼ã¿ãæ¶ãã¦ããã¾ããªããããå®ããã¼ãã¦ã§ã¢ã§å¤§éã®ã¢ã¯ã»ã¹ãæããã... ã£ã¦ä¹é¢ãããããããªãããªã¼ã¨æã£ã¦ãã
ãã®ãããªå ´åã«ã¯ãmy.cnf ã® innodb_flush_log_at_trx_commit ãã©ã¡ã¼ã¿ã調æ´ãããã¨ã§ãMyISAMã«æ¯è©ããæ¸ãè¾¼ã¿é度ãå¾ããã¨ãã§ãã(ãã®ããããã¯ã©ãã·ã¥ãé»æºæã®å ´åã¯ãè¨å®ã«ãã£ã¦ç´è¿ï¼ç§ä»¥å ã®å¤æ´ã失ããã)ã
ä»ã®ãã©ã¡ã¼ã¿ãå«ãã¦æ¸ãã¦ããã¨ããã¼ã¿ãã¼ã¹å°ç¨ãµã¼ã (on linux) ã®å ´åã¯ã
[mysqld] ... innodb_buffer_pool_size=3072M # innodbã«å²ãæ¯ãã¡ã¢ãªãå®ã¡ã¢ãªã®75%ç¨åº¦ innodb_log_buffer_size=256M # ãã¾ã大ãããã¦ãæå³ããªããããªæ°ããã... innodb_flush_log_at_trx_commit=0 # æ¯ç§ï¼åãã¼ã¿ããã£ã¹ã¯ã«æ¸ãåºã innodb_flush_method=O_DIRECT innodb_file_per_table ...
ããããèªåã®å¥½ã¿ã/etc/sysctl.conf ãç·¨éãã¦ã
vm.swappiness = 5
ã¨ãæ¸ãã¦ããã¨ãInnoDBã®ãããã¡ãã¼ã«ãã¹ã¯ããã¢ã¦ããããå¯è½æ§ãæ¸ã£ã¦å¹¸ãã«ãªããï¼ãã¨ãããããï¼ã
linux 以å¤ãããã㯠Apache ã¨åå± ããããããªå°è¦æ¨¡ãªéç¨ã§ã¯ãO_DIRECT ããã«
innodb_buffer_pool_size=512M # å®ã¡ã¢ãªã®10-20%? innodb_log_buffer_size=128M innodb_flush_log_at_trx_commit=0 innodb_file_per_table
ã¨ãã¦ãOSã®ãããã¡ãã£ãã·ã¥ã使ãã¨ããæãããã¨æãããããªã«ãã£ã±ããã¼ã¿ãã¼ã¹ç«ã¦ãçµé¨ãªããã©ããã¹ããã©ã¯ãã£ã¹ãã©ã®ããããªã®ãèå³ãããã®ã§ãããã¦æ¸ãã¦ã¿ãã
ãªããSATA HDDã使ã£ã¦ããããªã±ã¼ã¹ã§ã¯ã
% sudo hdparm -W 0 /dev/sda # å¿ è¦ãªã sdb ã sdc ãã
ãã¦ããã£ã¹ã¯ã®æ¸ãè¾¼ã¿ãããã¡ãç¡å¹åãã¦ããå¿ è¦ãããï¼ããã§ãªãã¨é»æºææã«ãã¼ã¿ãå£ããï¼ãããã¯ãã¼ã¿ãã¼ã¹ã½ããã¦ã§ã¢ã«éããªã話ã ãã©ã
åè:
Open database life: MyISAMとInnoDBのどちらを使うべきか
MySQL :: MySQL 5.6 リファレンスマニュアル :: 14.12 InnoDB の起動オプションおよびシステム変数
http://www.klab.jp/media/mysql/index3.html
http://kbase.redhat.com/faq/docs/DOC-18229