ãã¥ã¼ãã³ã°ã®åºç¤
ãããã§ã¯ãå ·ä½çã«InnoDBã§ã©ãããã¥ã¼ãã³ã°ããã¹ãããè¦ã¦ãããã
ãããã¡ãã¼ã«
ãæãåºæ¬ã¨ãªãã®ããããã¡ãµã¤ãºã®èª¿æ´ã ãã¯ã¼ãã³ã°ã»ãããå ¨ã¦ãããã¡ã«åã¾ããªãéãããããã¡ãã¼ã«ã¯å¤§ãããã°å¤§ããã»ã©è¯ãããã®åãã£ã¹ã¯ã¢ã¯ã»ã¹ãæ¸ãããã ããããã¡ãµã¤ãºãå°ããã¨ããã£ãã·ã¥ãã¹æã«ãã£ã¹ã¯ããReadããã®ã«æéãããããI/Oãããã«ããã¯ã«ãªã£ã¦ãã¾ããäºç®ã®ããéãã¡ã¢ãªãç®ãã£ã±ãæè¼ãããããã¡ãã¼ã«ã«å²ãå½ã¦ãããInnoDBã®ãããã¡ãã¼ã«ã¯ãinnodb_buffer_pool_sizeãªãã·ã§ã³ã§è¨å®ãããå©ç¨å¯è½ãªã¡ã¢ãªã¯ãä»ã®å¦çã«å¿ è¦ãªåãé¤ãããã¹ã¦ãInnoDBã®ãããã¡ãã¼ã«ã«å²ãå½ã¦ããã
ãinnodb_buffer_pool=32G
ãããã§ä¸ã¤æ³¨æããããinnodb_buffer_pool_sizeã¯ãããã¡ãã¼ã«ãã®ãã®ã®ãµã¤ãºãæå®ãããªãã·ã§ã³ã ããInnoDBã¯ãããã¡ãã¼ã«ã®ãµã¤ãºã«æ¯ä¾ãã¦ã¡ã¢ãªãæ¶è²»ãããªãã¸ã§ã¯ããåå¨ããããã®ãããinnodb_buffer_pool_sizeããã5ï½10%ã»ã©å¤ãã¡ã¢ãªãæ¶è²»ããã¨ãããã¨ãè¦ãã¦ãããã
ãã°ã®èª¿æ´
ãInnoDBã§ã¯ãå ¨ã¦ã®å¤æ´ã¯ãããã¡ãã¼ã«ä¸ã§è¡ãããå¾ããé ãã¦ãããã¡ãã¼ã«ã®å 容ããã¼ãã«ã¹ãã¼ã¹ã¸æ¸ãè¾¼ã¾ãããããã¦ãæ°¸ç¶æ§ãä¿è¨¼ããããã«ãã°ã«æ´æ°ããå 容ãè¨é²ããããã«ãªã£ã¦ããããã°ã¸ã®æ´æ°ã¯ã·ã¼ã±ã³ã·ã£ã«ãªæ¸ãè¾¼ã¿ã«ãªããããã¼ãã«ã¹ãã¼ã¹ã¸ã®æ¸ãè¾¼ã¿ã«æ¯ã¹ãã¨é«éã ããã ã
ãããã¨ãå¿ ç¶çã«ããã°ãã¡ã¤ã«ããã³ãããã¡ãã¼ã«ä¸ã«ã¯åå¨ãããããã¼ãã«ã¹ãã¼ã¹ã«ã¯åå¨ããªããã¨ãããã¼ã¿ãçãããã¨ã«ãªãããã®ãããªãã¼ã¿ãå«ãã ãã¼ã¸ã¯ããã¼ãã£ãã¼ã¸ãã¨å¼ã°ãããå½ç¶ãMySQLãµã¼ãã¼ãOSãã¯ã©ãã·ã¥ããã¨ãåèµ·åå¾ã«ã¯ãããã¡ãã¼ã«å ã®ãã¼ã¿ã¯å ¨ã¦å¤±ãããããããéè¦ãªãã¤ã³ããªã®ã ãããã¼ãã£ãã¼ã¸ã®ãã¼ã¿ã復å ããã«ã¯ãã°ã«ãã¼ã¿ãåå¨ãã¦ããå¿ è¦ãããããã®ãããã©ãã ãã®ãã¼ãã£ãã¼ã¸ãåå¨ã§ãããã¯ããã°ãã¡ã¤ã«ã®ãµã¤ãºã«ããã£ã¦ããããã¼ãã£ãã¼ã¸ãå¢ãããããã°ãã¡ã¤ã«ã®ç©ºã容éããªããªãã¨ãããã«æ´æ°ãç¶ããããã«ã¯ã¾ããã¼ãã£ãã¼ã¸ããã¼ãã«ã¹ãã¼ã¹ã¸ãã©ãã·ã¥ããå¿ è¦ããããããããªããã°æ°ãã«æ´æ°ã«ãã£ã¦ãã¼ãã£ãã¼ã¸ãçæãããã¨ãã§ããªãããã ã
ãã©ã®éæçµçã«ãã¼ãã£ãã¼ã¸ã¯ãã¼ãã«ã¹ãã¼ã¹ã¸æ¸ããã¾ããªããã°ãªããªãã®ã§ããã¼ãã£ãã¼ã¸ãããããä¿æåºæ¥ããã¨ã¯ããã»ã©ã¡ãªããããªãã¨æããããããç¥ããªããã ãããã¼ãã£ãã¼ã¸ã®ãµã¤ãºã大ããã¨ãããã¨ã¯ã次ã®2ã¤ã®æå³ã§ã¡ãªãããããã
- ä¸æ°ã«ããããã®ãã¼ã¿ãæ´æ°ãããå ´åããã®æ´æ°ã«ãããã£ã¹ã¯I/Oã®è² è·ãå 延ã°ãã«ï¼å¹³æ»åï¼ã§ãã
- ãã¼ãã£ãã¼ã¸ããã©ãã·ã¥ãããåã«åã³æ´æ°ããã確çãä¸æããããã«ããå¿ è¦ãªãã©ãã·ã¥ã®åæ°ãæ¸ã
ãå¾ã£ã¦ãã°ãã¡ã¤ã«ã大ããæ¹ãæ´æ°æ§è½ãé«ããªãã¨ããããã ããã°ãã¡ã¤ã«ã®ãµã¤ãºã¯ãinnodb_log_file_sizeããã³innodb_log_files_in_groupã§æå®ãããåè ã¯ãã°ãã¡ã¤ã«ã²ã¨ã¤ã®ãµã¤ãºãå¾è ã¯ãã°ãã¡ã¤ã«ã®åæ°ã§ãããMySQL 5.5ã§ã¯ãã°ãã¡ã¤ã«ã®ãµã¤ãºã¯åè¨ã§æ大4GBã¾ã§ã¨ããå¶éããããã ããéçºçã§ã¯MySQL 5.6.3ãã512GBã¾ã§ãã°ãã¡ã¤ã«ãæ¡å¼µãããã¨ãå¯è½ã«ãªã£ã¦ããã大ããªãããã¡ãã¼ã«ãå²ãå½ã¦ããªãããã®åãã°ãã¡ã¤ã«ã大ããªãã®ãå²ãå½ã¦ããã
ãæå¤ã¨è¦éããã¡ãªã®ããã°ãããã¡ãã¾ã ã³ãããããã¦ããªããã©ã³ã¶ã¯ã·ã§ã³ã¯ãæ大éãã°ãããã¡å ã«ãã£ãã·ã¥ãã¦ããã®ãæã¾ãããå¾ã£ã¦ãå¿ è¦ã¨ãªããã°ãããã¡ã®ãµã¤ãºã¯ã¯ã¼ãã³ã°ã»ãããµã¤ãºã§ã¯ãªããæ´æ°ã®éã¨ãã£ã¹ã¯ã®é度ã«ãã£ã¦å¤åãããã¢ããªããã®æ´æ°ãå¤ããããªãå¢ããã¦ã¿ã¦ãå¹æã測å®ãããããã°ãããã¡ã®ãµã¤ãºã¯innodb_log_buffer_sizeã§æå®ããã
ãã°ã®ãã©ãã·ã¥æ¹å¼
ããã©ã³ã¶ã¯ã·ã§ã³ã®ã³ãããæã«ãã®å 容ã¯ãã°ãã¡ã¤ã«ã«æ¸ãè¾¼ã¾ããããã®éãããã©ã«ãã§ã¯ãã£ã¹ã¯ã«ç¢ºå®ã«æ¸ãè¾¼ã¾ãããããfsyncã«ãããã£ã¹ã¯ã¸ã®åæãè¡ãããããã°ã®å 容ããã£ã¹ã¯ã«æ®ã£ã¦ããã°ããã·ã³ãçªç¶ã¯ã©ãã·ã¥ããå ´åãªã©ã§ããã¼ã¿ãæ¶å¤±ãããã¨ã¯ãªãããã°ã¸ã®æ¸ãè¾¼ã¿ã¯ã·ã¼ã±ã³ã·ã£ã«ãªã®ã§ã©ã³ãã ã¢ã¯ã»ã¹ã¨æ¯è¼ããã¨é«éã§ã¯ããããããã§ããã£ã¹ã¯ã¸ã®åæã¯ã¨ã¦ãæéã®ãããå¦çã ãããåæãããªãã§æ¸ãã®ãªããInnoDBã®æ´æ°é度ã¯é£èºçã«åä¸ããã
ãä¾ãã°ãã¬ããªã±ã¼ã·ã§ã³ã®ã¹ã¬ã¼ããæºåæã¬ããªã±ã¼ã·ã§ã³ã®ãã¹ã¿ã¼ã§ããã°ãä¸ãä¸ã¯ã©ãã·ã¥ããå ´åã§ãä»ã®ãµã¼ãã¼ãããã¼ã¿ã®å¾©æ§ãå¯è½ã§ããããæºåæã¬ããªã±ã¼ã·ã§ã³ãç¨ããHAåææ³ã«ã¤ãã¦ã¯ã以åããã°ã§ç´¹ä»ããã®ã§èå³ãããã°ãã¡ããè¦ã¦é ããããåèï¼æ¼¢(ãªãã³)ã®ã³ã³ãã¥ã¼ã¿é: æå¼·ã®MySQL HAåææ³ - Semi-Synchronous Replication
ããã£ã¹ã¯ã¸ã®åæãOFFã«ããã«ã¯ãinnodb_flush_log_at_trx_commitãããã©ã«ãã®1ããå¤æ´ãããã