ããã«ã¡ã¯ãä¼å¡äºæ¥é¨ã®æ°äºã§ããä½æãå ¨ã¦ Auto Chess ã«å°ããã¦ãã¾ãã
éå»ãã®ããã°ã«ã¯ãµã¼ãã¹éçºã«é¢ããè¨äº*1ãæ稿ããã¦ããã ãã¦ããã®ã§ãããä»åã¯ã·ã¹ãã æ¹ä¿®ã«ã¤ãã¦ã®è¨äºã«ãªãã¾ãã ã¯ãã¯ãããã«ã¯æ¤ç´¢ãããã¨å¼ã°ãã大è¦æ¨¡ãªããããåå¨ããã®ã§ãããä»åãããå·æ°ãããã¨ã«æåãã¾ããã ããã§ãã®è¨äºã§ã¯æ§ã·ã¹ãã ã«åå¨ãã¦ããåé¡ç¹ãæ°ã·ã¹ãã ã®ç¹å¾´ãå®éã®éçºã«ã¤ãã¦è¿°ã¹ããã¨æãã¾ãã
èæ¯
ã¯ãã¯ãããã®ã¬ã·ãæ¤ç´¢ã§ã¯ Apache Solr ãæ¤ç´¢ãµã¼ãã¼ã¨ããå ¨ææ¤ç´¢ãå©ç¨ãã¦ãã¾ããå¤ã㯠Tritonn ãå©ç¨ã㦠MySQL ã«ä½ãããå°ç¨ table ã対象ã«å ¨ææ¤ç´¢ãå®è¡ãã¦ããããã§ããããã®é ãããæ¤ç´¢ããããã¨å¼ã°ããããããåå¨ãã¦ãã¾ããã ãã®ãããã¯ãç°¡åã«è¨ãã¨ãæ¤ç´¢ã¤ã³ããã¯ã¹ãã¨å¼ã°ããæ¤ç´¢ç¨ã¡ã¿ãã¼ã¿ãçæãããã®ã§ããé¢é£åæãããã¼ã¿ãåéããåãã¡æ¸ããã¹ã³ã¢ã®è¨ç®ã¨ãã£ãå¦çãå®è¡ãã¦æ¤ç´¢ã¤ã³ããã¯ã¹ãçæããç¾å¨ã¯ããã Solr ã«ã¢ãããã¼ãããã¨ããã¾ã§ãå®è¡ããããã群ã¨ãªã£ã¦ãã¾ãã
ãã®æ¤ç´¢ããã㯠10 年以ä¸å©ç¨ããã¦ãããå¹´ã æ¤ç´¢ã®ã¡ã¿ãã¼ã¿ã¨ãã¦ä½¿ç¨ããããã¼ã¿ï¼fieldï¼ãå¢å ãã¦ãããã¨ããã£ã¦ã種ã ã®åé¡ãæ±ããã¬ã¬ã·ã¼ã·ã¹ãã ã¨ãªã£ã¦ãã¾ããããµã¼ãã¹ã«ã¨ã£ã¦é常ã«éè¦ãªã·ã¹ãã ã§ãããããã«æãåã£ãæ¹ä¿®ã«è¸ã¿åããªãã£ãã®ã§ãããä»åã®ããã¸ã§ã¯ãã¯ãã®ä¸æ°ãç®çã¨ãããã®ã§ãã*2ã
æ§æ¤ç´¢ãããã®åé¡ç¹
è¤æ°ã® DB ããµã¼ãã¹ã«ä¾åãã¦ãã
æ¤ç´¢ãããã¯ã¬ã·ãæ
å ±ã«ã¨ã©ã¾ãããã¬ã·ãã«ç´ã¥ãæ§ã
ãªã¡ã¿ãã¼ã¿ããå¥ãããã«ãã£ã¦éç´ãããæ
å ±ãªã©ãåéããå¿
è¦ããããããä¾åå
ã®ãµã¼ãã¹ã DB ãå¤å²ã«ããã£ã¦ãã¾ããã
DB ã§ããã°ã¬ã·ããµã¼ãã¹ãå©ç¨ãã¦ãã main
, éç´ããããã¼ã¿ãæ ¼ç´ããã¦ãã cookpad_summary
, æ¤ç´¢ãç 究éçºé¢é£ã®ãã¼ã¿ãæ ¼ç´ããã¦ãã search_summary
ãªã©ãªã©â¦â¦ããµã¼ãã¹ã¸ã®ä¾åã«ã¤ãã¦ããæçåç»ãµã¼ãã¹ã® API ãå©ãã¦ãã®ã¬ã·ãã«æçåç»ãç´ä»ãããã¦ããããåå¾ãã¦ãããªã©ã®å¦çããããªããã¦ãããæ°è¦äºæ¥ã次ã
ã«å¢ãã¦ããç¾å¨ã®ç¶æ³ãèããã¨ããã®æã®ä¾åã¯ãããããå¢å¤§ãããã¨ãäºæ³ããã¦ãã¾ããã
cookpad_all ã«åå¨ãã¦ãã
æ§æ¤ç´¢ããã㯠cookpad_all ã¨å¼ã°ãããã¬ã·ã Web ãµã¼ãã¹ã¨ãã®ç®¡çç»é¢ãé¢é£ããããã群ãmobile ã¢ããªç¨ API ãªã©ããã¹ã¦çãè¾¼ã¾ããã¬ãã¸ããªä¸ã«åå¨ãã¦ãããåãµã¼ãã¹éã§ã¢ãã«ã®ãã¸ãã¯çãå ±æããã¦ãã¾ããããã®ãã¨èªä½ã¯ããã»ã©å¤§ãããªãè¦æ¨¡ã®ãµã¼ãã¹ã§ããã°åé¡ã«ãªããã¨ã¯ããã¾ãããããããã¯ãã¯ãããã«ã¤ãã¦è¨ãã°ããã¸ãã¯å ±æãéãããµã¼ãã¹éã®ä¾åãææ¡ããã®ãå°é£ãªè¦æ¨¡ã«ãªã£ã¦ããããã¬ã·ããµã¼ãã¹ã«å¤æ´ãå ããããããã®æåãæå³ããå¤ãã£ããã¨ãããããªãã¨ãèµ·ããå¯è½æ§ãããã¾ããããã®ãããªç¶æ³ã§ãã£ããããç¹ã«æ°ããã¡ã³ãã¼ãã³ã¼ãã«å¤æ´ãå ããéã«èããã¹ãè¦ç´ ãå¤ããã¦çç£æ§ãèããä½ä¸ãããã°ãåãè¾¼ãã§ãã¾ãå¯è½æ§ãé«ããªã£ã¦ãã¾ã£ã¦ãã¾ããã
ä¸å¿ è¦ã« Rails ã§ãã
cookpad_all ã«åå¨ããããã群㯠kuroko ã¨å¼ã°ãã¦ãã¾ããããããã Rails ã§å®è£ ããã¦ãããã¨ãããæ§æ¤ç´¢ãããã Rails ã§å®è£ ããã¦ãã¾ããã ãããããã®ãããã®å®æ ã¯ã大éã®ãã¼ã¿ãåéãã¦å¦çããããã¨ã§ãããuser facing 㪠Web ã¢ããªã±ã¼ã·ã§ã³ããã°ããéçºãããã¨ãã§ãããã¨ãã Rails ã®å¼·ã¿ãæ´»ãããããããªãã®ã§ã¯ããã¾ããã§ããã å®éã®å®è£ ã¨ãã¦ãããã®å¤§é¨åãããã¼ã¿ãåå¾ããããã ãã« ActiveRecord ã®ã¤ã³ã¹ã¿ã³ã¹ã大éã«çæãããã¨ãã£ããã¸ãã¯ã§æ§æããã¦ããããªã¼ãã¼ãããã®å¤§ãããç®ç«ã¤ãã®ã«ãªã£ã¦ãã¾ããã
責åã大ãããã
æ§æ¤ç´¢ãããã§ã¯ãæ¤ç´¢ã¤ã³ããã¯ã¹ã«ãããå ¨ã¦ã® field ãä¸ã¤ã®ã¡ã½ããå ã§çæããã¦ãã¾ããããã®ãããæ°ã㪠field ã®è¿½å ãæ¢åã® field ã®ç·¨éã«ããã¦å¿ ããã®ã¡ã½ããã«æãå ¥ããå¿ è¦ããããã¡ã³ããã³ã¹æ§ã«åé¡ãæ±ãã¦ãã¾ããã
ãã¨ãã°ãæ°ã㪠field ã追å ããéã«è©²å½ã¡ã½ããå ã«åå¨ããæ¢åã®ãã¸ãã¯ãè¸è¥²ããã¨ãã¾ããããããã¯ãã¯ãããã«ã¯ãã¬ã·ããã表ç¾ããã¢ãã«ãè¤æ°åå¨ãããããæ¢åãã¸ãã¯ã§å©ç¨ããã¦ãããã¬ã·ããã表ç¾ããã¢ãã«ã¨ãæ°ã㪠field ã®ãã¸ãã¯ãåç §ããã¹ãã ã£ããã¬ã·ããã®ã¢ãã«ãé£ãéã£ã¦ãããæå³ããæåã«ãªã£ã¦ããªãã£ãã¨ãã£ããããªåé¡ãèµ·ãããã¨ãããã¾ããã
ã¾ããç 究éçºé¨ã®æ½çã§æ¤ç´¢ã¤ã³ããã¯ã¹ã« field ã追å ãããã±ã¼ã¹ãªã©ãã¬ã·ããµã¼ãã¹ã«ãããæ¤ç´¢æ©è½ã®éçºä»¥å¤ã主æ¥åã¨ãã¦ããã¡ã³ãã¼ãæ¤ç´¢ãããã«æãå ¥ãããã¨ãããã¾ããããã®ããã«ãã¹ãã¼ã¯ãã«ãã¼ã®è¦³ç¹ããè¦ã¦ãè¤æ°ã®çç±ãããã®ããããç·¨éããã¦ããããåä¸è²¬ä»»ã®ååããæºãããã¦ããªãã·ã¹ãã ã«ãªã£ã¦ãã¾ã£ã¦ãã¾ããã
å®è¡æéãé·ããã
æ§æ¤ç´¢ãããã§ã¯ãã¹ã¦ã® field ãçæããå¦çãç´åã«å®è¡ããã¦ãããããRails ã§ã®å®è£ ã§ããã¨ãããã¨ãç¸ã¾ã£ã¦å®è¡æéãé常ã«é·ããªã£ã¦ãã¾ã£ã¦ãã¾ããã ãã®æéã¯ãããã®æ§æããã®ã¾ã¾ã§ãããã¡ã¯ä»å¾ã field ã®å¢å ã«ä¼´ã£ã¦å¢å¤§ãã¦ãããã¨ãäºæ³ããã¦ãã¾ããããå®è¡æéç縮ã®ããã«èªåã§ä¸¦åå®è¡ã®å®è£ ããããªã£ã¦ããã®ãå¯èªæ§ãã¡ã³ããã³ã¹æ§ã«å½±é¿ãä¸ãã¦ãã¾ããã
æ°æ¤ç´¢ãããæ¦è¦
ä¸ã«æããæ§æ¤ç´¢ãããã®åé¡ç¹ã解æ¶ãããããæ°æ¤ç´¢ãããï¼ä»¥ä¸ fushigibana*3ï¼ã¯ä»¥ä¸ã®è¦ç´ ãå®ç¾ããããã«å®è£ ããã¾ããã
ãã¼ã¿ããã¼ã®ä¸æ¬å
å ã»ã©ãæ¤ç´¢ãããã¯ãã®æ§è³ªä¸å¤ãã®ç®æãããã¼ã¿ãåéãå å·¥ããå¿ è¦ããããã¨è¿°ã¹ã¾ããããç¾å¨ã¯ãã¯ãããã«ã¯çµç¹å ã®ãããããã¼ã¿ãéç´ããã¦ãã DWH ãåå¨ãã¾ããå種ãã¼ã¿ã½ã¼ã¹ãã DWH ã¸ã®ã¤ã³ãã¼ãã¨ããä½æ¥ãåå¨ãããããã¼ã¿ã®æ´æ°é »åº¦ã«é¢ããåé¡ã¯ããã¾ãããæ§æ¤ç´¢ãããã®æç¹ã§æ¤ç´¢çµæã®æ´æ°ã¯æ¥æ¬¡å¦çã§ãã£ããã¨ãéã¿ãfushigibana ãå©ç¨ãããã¼ã¿ã½ã¼ã¹ã¯ DWH ã«éå®ãã¾ããããããããã¨ã§å種 DB ããµã¼ãã¹ã¸ã®ä¾åã解æ¶ããããã¼ã¿ããã¼ãä¸æ¬åãããã¨ãå¯è½ã¨ãªãã¾ããã
Rails ãªãã³ã« cookpad_all ããã®è±å´
fushigibana 㯠redshift-connector ãç¨ã㦠DWH ããåå¾ãããã¼ã¿ã«ãRuby ã§åãã¡æ¸ããªã©ã®å¦çãæ½ãã¦æ¤ç´¢ã¤ã³ããã¯ã¹ãçæããããã S3 ã«ã¢ãããã¼ãããã¨ããã¤ããã«ãªã£ã¦ãããplain Ruby ã§å®è£ ããã¦ãã¾ã(Ruby ãé¸æããã®ã¯ç¤¾å ã«åå¨ããåãã¡æ¸ãç¨ã® gem ãªã©ãå©ç¨ãããã)ããã®éç¨ã§ cookpad_all ãããã³ã¼ããã¼ã¹ãåé¢ããå®å ¨ã«ç¬ç«ããããã群ã¨ãã¦åå¨ãããã¨ã«ãªãã¾ããã
ã¯ã©ã¹ã®åå²ã¨ä¸¦åå®è¡
fushigibana ã§ã¯æ¤ç´¢ã¤ã³ããã¯ã¹ã®çæå¦çããµã¼ãã¹ã«ãããæå³ãã¢ã¯ã»ã¹ãã table ãªã©ã®è¦³ç¹ããåå²ãããåä¸è²¬ä»»ã®ååããæºããããå®è£ ãã¦ãã¾ããåå²ãããã¯ã©ã¹ã¯ããããããã¤ãã® field ãæã¤æ¤ç´¢ã¤ã³ããã¯ã¹ãçæãã¾ããæå¾ã«ãããã®ã¤ã³ããã¯ã¹ã join ãããã¨ã§ãã¹ã¦ã® field ãæã£ãæ¤ç´¢ã¤ã³ããã¯ã¹ãçæãã¦ãã¾ãããããããã¨ã§ãããããã®ã¯ã©ã¹ã並åå®è¡ãããã¨ãå¯è½ã«ãªãããããã®å®è¡æéãç縮ããã¾ããã
ã¾ããæ¤ç´¢ã¤ã³ããã¯ã¹ã«æ°ãã field ã追å ããéã«ããæ¢åã®ãã¸ãã¯ã«æãå ãããã¨ãªãæ°ããã¯ã©ã¹ãå®è£ ãããã¨ã§å¯¾å¿ãå¯è½ã¨ãªããã·ã¹ãã å ¨ä½ã§è¦ã¦ãããªã¼ãã³ã»ã¯ãã¼ãºãã®ååããæºããããããã¨ãªãã¾ããã
fushigibana ã®éçºã¨ç§»è¡ä½æ¥
ããããã¯ãå®éã«ã©ã®ããã«ã㦠fushigibana ãéçºãããããã©ã®ããã«ãã¦æ¬çªç°å¢ã«é©ç¨ãããã«ã¤ãã¦è¿°ã¹ã¦ããã¾ãã
éçºã®æµã
fushigibana ã®éçºã¯ã大ã¾ãã«æ¬¡ã®ãããªæµãã§ãããªããã¾ããã
- ç¾ç¶ã®èª¿æ»
- ãã¸ãã¯ã® SQL å
- æ°ãã¸ãã¯ã®æ¤è¨¼
- staging ç°å¢ã«ãããæ¤ç´¢ã¬ã¹ãã³ã¹ã®æ¤è¨¼
- kuroko ä¸ã§ã®æ¬çªéç¨
- ã³ã¼ããã¼ã¹ã®åé¢
ç¾ç¶ã®èª¿æ»
æ§æ¤ç´¢ãããã®æ¹ä¿®ã«å ¥ãåã«ã¾ãã¯ç¾å¨å©ç¨ããã¦ããªã field ãæ´ãåºããå°ãã§ã移è¡æã®è² æ ã軽æ¸ãããã¨ãç®æãã¾ããã ã³ã¼ãã grep ãã¦ä¸è¦ä½¿ããã¦ããªããã㪠field ã«ã¤ãã¦èè ã«èãã¦åãã¾ãã ãã®è¾ºãã¯å®å ¨ã«èå¤å¦ã®åã«å ¥ã£ã¦ãããä½æ¥ã®ä¸ã§éå»ã®ãµã¼ãã¹ã«ã¤ãã¦ãããããªã¨ãã½ã¼ããç¥ããã¨ãã§ãã¦ãããããã£ãã§ãã ãã®ä½æ¥ã®å¾ãæçµçã«ã¯ 111 ã® field ã«ã¤ãã¦ãã¸ãã¯ã®ç§»è¡ããããªããã¨ã«ãªãã¾ããã
ãã¸ãã¯ã® SQL å
æ¢åã® Rails ãã¸ãã¯ãåè¦ããªããã²ããã SQL ã«æ¸ãæãã¦ããã¾ããä¸ã«ã¯æ¢åã®ãã¸ãã¯ã®æåãæ確ã§ãªããã®ãåç´ã«ãã°ã£ã¦ãããã®ãªã©ãåå¨ãã¦ãããé©å®ç´ããªããã²ããã SQL ã«æ¸ãæãã¾ããæçµçã«ã¯ 32 ã®ã¯ã©ã¹ã§ 111 ã® field ãçæãããã¨ã«ãªãã¾ããã
æ°ãã¸ãã¯ã®æ¤è¨¼
æ°æ§ãã¸ãã¯ã§çæããæ¤ç´¢ã¤ã³ããã¯ã¹å士ãæ¯è¼ãããã¨ã§ãæ°ãã¸ãã¯ã®å¦¥å½æ§ãæ¤è¨¼ãã¾ãã ããã¼ã¿ã½ã¼ã¹ãå¤ãããããããããã¼ã¿ã®æ´æ°ã¿ã¤ãã³ã°ãéããããã¸ãã¯æ¹ä¿®ã®éã«ãã°æ¹ä¿®ããããªã£ãããªã©ã®çç±ããå³å¯ãªæ¯è¼ã¯ä¸å¯è½ã§ããããã§ããç¯å²ã§æ°ãã¸ãã¯ã®ä¸å ·åãæ½°ãã¦ããã¾ããã
éçºç°å¢ã«ãããæ¤ç´¢ã¬ã¹ãã³ã¹ã®æ¤è¨¼
ããããã®æ¤ç´¢ã¤ã³ããã¯ã¹ãã¢ãããã¼ããã Solr ã«å¯¾ãã¦æ¤ç´¢ãªã¯ã¨ã¹ããæãããã®ã¬ã¹ãã³ã¹ãæ¯è¼ãã¾ãã å®éã«éçºç°å¢ã®ã¬ã·ããµã¼ãã¹ãå©ç¨ãã¦æåã§æåã確èªãããã¨ã¯ãã¡ãããæ¤ç´¢åæ°ä¸ä½ 1000 ãã¼ã¯ã¼ãã»ã©ã«ã¤ãã¦ã¹ã¯ãªãããåããã人æ°é ããæ°çé ãã調çæéçµãè¾¼ã¿ããªã©ãå©ç¨ã¦ã¼ã¶ã¼æ°ãéè¦åº¦ã®è¦³ç¹ããé¸æãããããã¤ãã®æ©è½ã§çºè¡ãããæ¤ç´¢ã¯ã¨ãªã®ã¬ã¹ãã³ã¹ä»¶æ°ãé åºãæ¯è¼ãã¾ããã ããã§ãå³å¯ãªæ¯è¼ã¯ã§ããªããã®ã®ãã¦ã¼ã¶ã¼è¦ç¹ã§éè¦ãªä½é¨ã«çµã£ãä¸ã§ãããç¨åº¦ã®èª¤å·®ã許容ãããã誤差ã®åå ãç¹å®ãããã¨ãç®çã¨ããããã¨ã§è²»ç¨å¯¾å¹æãæèãã¦æ¤è¨¼ä½æ¥ãé²ãã¾ããã
æ§å®è¡ç°å¢ä¸ã§ã®æ¬çªéç¨
æ¬çªéç¨ã«å ¥ãã«ããã£ã¦ãããªãã³ã¼ããã¼ã¹ãåé¢ããã®ã§ã¯ãªããã¾ãã¯æ¢åã®ããããåãã¦ããã·ã¹ãã ã®ä¸ã§æ°ãã¸ãã¯ãèµ°ãããæ¹éãåãã¾ãããããã¯ããªã«ãåé¡ããã£ãéã«ãããããã³ã¼ããã¼ã¹ã®åé¢ã§ã¯ãªãæ°ãããã¸ãã¯ãã®ãã®ã«åé¡ãããããã¨ãä¿è¨¼ããããã®ã¹ãããã§ãã
ã³ã¼ããã¼ã¹ã®åé¢
ä¸è¨ã®ã¹ãããã§æ°ãã¸ãã¯ã«åé¡ããªããã¨ã確èªããä¸ã§ã³ã¼ããã¼ã¹ãåé¢ãã¦ããã¾ããå®éã«ã¯ cookpad_all å ã«åå¨ãããã¸ãã¯ãããã¤ã社å gem ã«ç§»è¡ãããªã©ã®ä½æ¥ãçºçãããããæ°ãã¸ãã¯ã®å¦¥å½æ§ãå®å ¨ã«ä¿è¨¼ãããç¶æ ã§ã³ã¼ããåé¢ã§ããããã§ã¯ããã¾ããã§ããããããã§ãä¸åº¦æ¢åã®ã·ã¹ãã ä¸ã§åé¡ãªãå®è¡ã§ãã¦ããããæ¯è¼çä¸å®ãªãåé¢ãé²ãããã¨ãã§ãã¾ããã
移è¡ä½æ¥ã«ãããå®å ¨æ§ã®ä¿è¨¼
æ¤ç´¢ããããå½±é¿ãä¸ããã¬ã·ããµã¼ãã¹ã¯é常ã«å¤ãã®ã¦ã¼ã¶ã¼ãå©ç¨ãã¦ãããµã¼ãã¹ã§ããã移è¡ä½æ¥ã«éãã¦ä¸å ·åãçºçããå¯è½æ§ã¯å¯è½ãªéãæããå¿ è¦ãããã¾ããã ä»åã®éçºã§ã¯ã·ã¹ãã ã®å®å ¨æ§ã以ä¸ã® 4 å°ç¹ã§æ¤è¨¼ãã¦ããåæ ãã¦ãã¾ãã
- æ°ãã¸ãã¯ã®çæããæ¤ç´¢ã¤ã³ããã¯ã¹ã¨ãæ§ãã¸ãã¯ã®çæããæ¤ç´¢ã¤ã³ããã¯ã¹ãæ¯è¼
- æ°æ¤ç´¢ã¤ã³ããã¯ã¹ãã¢ãããã¼ããã Solr ãè¿ãã¬ã¹ãã³ã¹ã¨ãç¾å¨ã® Solr ãè¿ãã¬ã¹ãã³ã¹ãæ¯è¼
- æ°æ¤ç´¢ã¤ã³ããã¯ã¹ã production ã® Solr ã«ã¢ãããã¼ãããå¾ãç¾å¨ã®æ¤ç´¢çµæã¨åæ¥ã®æ¤ç´¢çµæãæ¯è¼
- ã¦ã¼ã¶ã¼ããã®åãåãããç£è¦
ãã®ãã¡ã1 㨠2 ã«ã¤ãã¦ã¯ä¸è¿°ãããéçºã®æµããã«ããããæ°ãã¸ãã¯ã®æ¤è¨¼ãã¨ãéçºç°å¢ã«ãããã¬ã¹ãã³ã¹ã®æ¤è¨¼ããã®ãã®ã§ãããããããã§ã¯ 3 㨠4 ã«ã¤ãã¦è¿°ã¹ã¾ãã
åæ¥ã¨ã®æ¤ç´¢çµæã®æ¯è¼
ã¯ãã¯ãããã® Solr 㯠master-slave æ§æã§éç¨ããã¦ãããæ¤ç´¢ã¤ã³ããã¯ã¹ã master Solr ã«ã¢ãããã¼ããããå¾ãã¦ã¼ã¶ã¼ããã®ãªã¯ã¨ã¹ããåãã slave Solr ããããã¬ããªã±ã¼ã·ã§ã³ãã¦ããå½¢ã«ãªã£ã¦ãã¾ãï¼å³å¯ã«ã¯ããã«å ãã¦ãã£ãã·ã¥æ©æ§ããã£ãããã¾ãï¼ãéã«ããã¨æ¤ç´¢ã¤ã³ããã¯ã¹ãã¢ãããã¼ããã¦ããslave ã®ã¬ããªã±ã¼ã·ã§ã³å¦çããããªããªããã°ã¦ã¼ã¶ã¼ã¸ã®å½±é¿ã¯åºãªãã¨ãããã¨ã«ãªãã¾ãã
ãã®ä»çµã¿ãå©ç¨ãã¦ãæ¤ç´¢ã¤ã³ããã¯ã¹ãã¢ãããã¼ãããå¾æ¤ç´¢åæ°ä¸ä½ã®åãã¼ã¯ã¼ãã«ã¤ãã¦åæ¥ã®æ¤ç´¢çµæã¨æ°ããæ¤ç´¢çµæã件æ°ãã¼ã¹ã§æ¯è¼ãã大ããªå·®ããã£ãå ´åã¬ããªã±ã¼ã·ã§ã³ãå®è¡ããªãã¨ãããã¹ãæ©æ§ãåå¨ãã¦ãã¾ããã ãã®æ©æ§ã¯æ¤ç´¢ã¤ã³ããã¯ã¹ã®çæãã¸ãã¯ãå¤æ´ãã¦ãåé¡ãªãå©ç¨ã§ãããã®ã§ãã£ãããããã®ã¾ã¾æ´»ç¨ãããã¨ã«ãªãã¾ããã
ã¦ã¼ã¶ã¼ããã®åãåããç£è¦
ãããéçºæ®µéã§ã®æ¤è¨¼ãç¹°ãè¿ãã¦ããå®éã«ä¸å ·åã®åºãå¯è½æ§ã 0 ã«ãããã¨ã¯ã§ãã¾ãããå½ç¶ã®ãã¨ã§ã¯ããã¾ãããæ¬çªé©ç¨æ¥ã¯ã¤ã³ãã©ããµãã¼ããã¼ã ã«å ±æããä¸ãä¸ã®ã¨ãã«ãã°ãããã¼ã«ããã¯ã§ããããæ¤ç´¢ã¤ã³ããã¯ã¹ãã¦ã¼ã¶ã¼ããã¢ã¯ã»ã¹ã®ããªã slave Solr ã«ããã¯ã¢ããããä¸ã§åæ ä½æ¥ãå®æ½ãã¾ããã ãã®å¾ãã¦ã¼ã¶ã¼ããå±ããåãåããã«ã¯å®æçã«ç®ãéããfushigibana å°å ¥ã«ããä¸å ·åããããã®ãå ±åããã¦ããªããã©ããã確èªãã¦ãã¾ããã
ããã¸ã§ã¯ãã®æ¯ãè¿ã
ææ
以ä¸ã«è¿°ã¹ãããã«æ¤ç´¢ãããã®æ¹ä¿®ããããªã£ãçµæãã©ã®ãããªææãå¾ããã¨ãã§ããã®ããã¾ã¨ãã¾ãã åé ã«ä¸ãããæ§æ¤ç´¢ãããã®åé¡ç¹ãã«ã¤ãã¦ã¯ãããã
- è¤æ°ã® DB ããµã¼ãã¹ã«ä¾åãã¦ãã
- DWH ããã¼ã¿ã½ã¼ã¹ã¨ãããã¨ã§è§£æ¶ãã
- cookpad_all ã«åå¨ãã¦ãã
- å¥ã¬ãã¸ããªã«åãåºãã¦å®è£ ãããã¨ã§è§£æ¶ãã
- çµæ cookpad_all ãã 1,357 è¡ã®ã³ã¼ããåé¤ãããã¨ã«æåãã
- ä¸å¿
è¦ã« Rails ã§ãã
- plain Ruby ã¨ãã¦å®è£ ãããã¨ã§è§£æ¶ãã
- 責åã大ãããã
- index-generator ãè¤æ°ã®ã¯ã©ã¹ã«åå²ãã¦å®è£ ãããã¨ã§è§£æ¶ãã
- ãå°ããªå¦çã並åã§å®è¡ãããå½¢ã«æ¹ä¿®ãããã¨ã§ãªãã©ã¤å¦çãå ¥ãããããªãããããå ¨ä½ã®å®å®æ§ãåä¸ãã
- åæ§ã®çç±ã§ãããå®è¡åºç¤ã® spot instance åãéæãããå°æ¥çã«ã¯ã³ã¹ãåæ¸ã«ãç¹ãããã
- å®è¡æéãé·ããã
- åå²å®è£ ãã index-generator ã並åå®è¡ãããã¨ã§è§£æ¶ãã
- å ·ä½çã«ã¯å ¨ä½ã§ 7.5h ããã£ã¦ãããã®ã 4.5h ã¨ãªããç´ 3 æéã®ç縮åã«æåãã
ã¨ããå½¢ã§è§£æ±ºãããã¨ãã§ãã¾ããã ä¸å¯§ã«æ¤è¨¼ãã§ã¼ãºãéãããã¨ããããä»ã®ã¨ããä¸å ·åãã¦ã¼ã¶ã¼ããã®ãåãåããããªãå®å®ãã¦ç¨¼åãã¦ãã¾ãã ã¾ããä¸è¨ã«å ãã¦ãã³ã¼ãã®è¦éããæ¹åãããã¨ã«ããéçºã®å®¹æåãããããã¥ã¡ã³ãã¼ã·ã§ã³ã«ããã·ã¹ãã å ¨ä½åã®å ±æãã¨ãã£ãææããããæ¤ç´¢ãããå¨ãã®ç¶æ³ã¯ä»åã®ããã¸ã§ã¯ãã«ãã£ã¦å¤§ããæ¹åããã¾ããã
åç
ä»åã®ä¸çªå¤§ããªåçç¹ã¯ããã¸ã§ã¯ãã®æéãé延ã³ãã¦ãã¾ã£ããã¨ã§ãã çæãã¦ã¿ãçµæè¦ç©ãããå¤ãã£ãã»ããã¸ã§ã¯ãã®ã¹ã³ã¼ããåºããªã£ã¦ãã£ãã¨ããäºå®ãããããä»æ¹ã®ãªãã¨ãããããã¾ããããç¹ã«æ¤è¨¼ãã§ã¼ãºã«ããã¦ã¯ããè²»ç¨å¯¾å¹æã®é«ãæ¹æ³ã模索ãããã¨ãã§ããã®ã§ã¯ãªããã¨æãã¾ãã
ãã¨ãã°æ¤ç´¢ã¤ã³ããã¯ã¹ã®æ¯è¼ã¨ Solr ã¬ã¹ãã³ã¹ã®æ¯è¼ã¯ããªãè¿ãã¬ã¤ã¤ã¼ã«å±ãããã®ã§ãããã©ã¡ããä¸æ¹ãçç¥ãã¦ãæ¤è¨¼ã®ç²¾åº¦ã«å¤§ããªå·®ã¯åå¨ããªãã£ãå¯è½æ§ãããã¾ãã çµæã¨ãã¦ãä¸å ·åãåºã¦ããªããã¨ããäºå®ã¯åã°ãããã¨ã§ãããçµç¹ã«ã¨ã£ã¦ã¯ã¨ã³ã¸ãã¢ãªã½ã¼ã¹ãéè¦ãªè³æºã§ãããä»å¾ã¯ããããã³ã¹ããã«ã¤ãã¦ããã£ããã¨æèããã¦ããã»ã¹ãã¢ã¼ããã¯ãã£ã®é¸å®ããã¦ããããã¨æãã¾ãã
ä»å¾ã®èª²é¡
ä»åã®ãããæ¹ä¿®ã¯ããã¾ã§ãã¬ã·ãæ¤ç´¢ãã«ã¤ãã¦ã®ãã®ã§ãããã¤ããã½æ¤ç´¢ããè£å®ãã¼ã¯ã¼ãæ¤ç´¢ããªã©ã«ã¤ãã¦ã¯ï¼ã¾ãå¥ã®ï¼å¤ãã·ã¹ãã ã§åãã¦ãã¾ãã ä»å¾ã¯ãããã®æ¤ç´¢ã¤ã³ããã¯ã¹ãçæããã·ã¹ãã ã«ã¤ãã¦ãæ¹ä¿®ããããªãå¿ è¦ãããã¨æãã¾ããããã®éã« fushigibana ã«ä¹ããã®ãããããã¯ã©ãé¢ä¿ãããã®ãã¨ããã®ã¯ãã£ããã¨èæ ®ããå¿ è¦ãããã¨æãã¾ãã
fushigibana ãã®ãã®ã«ã¤ãã¦ã®èª²é¡ã¨ãã¦ã¯ãç¾å¨ AWS Glue ã¸ã®ã¹ãã¼ãç»é²ã AWS console ããæåã§ãããªãå¿ è¦ããããã¨ãããããã¾ãã ããã¥ã¡ã³ãã¯æ®ãã¦ãããã®ã®ããã®ä½æ¥ã ã fushigibana ã®ãªãã¸ããªä¸ã§å®çµããªãã®ã¯éçºè ã«åªãããªãã¨æãã¦ãã¾ãããã¹ãã¼ãå®ç¾©ãã¡ã¤ã«ã®å 容ã«å¾ã£ã¦ AWS Glue ã® API ãå©ãã¹ã¯ãªãããå®è£ ãããã¨ãã£ããããªè§£æ±ºçãåãã¹ãã§ããã¨æã£ã¦ãã¾ãã
ã¾ã¨ã
ä»åã®è¨äºã§ã¯ã¯ãã¯ãããã«ãããæ¤ç´¢ãããã·ã¹ãã ã®æ¹ä¿®ã«ã¤ãã¦è§£èª¬ãã¾ããã ãç¾ç¶ã®ã·ã¹ãã ã調æ»ãããã¨ã§æ´ãåºããåé¡ç¹ã解決ããæ§æãèããæè¡ãç¨ãã¦å¯è½ãªéãã·ã³ãã«ã«å®ç¾ãããã¨ããå½ç¶ãã¤é£ãããã¨ããè¦æ¨¡ã®å¤§ããªã·ã¹ãã ã«å¯¾ãã¦å®è·µããã®ã¯é常ã«ããããããããã¨ã³ã¸ãã¢å¥å©ã«å°½ããä»äºã§ããã ã·ã¹ãã ã®æ§æãç¾æç¹ã«ããããæ®éãã«ããªãè¿ããã®ã«ãªã£ã¦ãããä»å¾ã®éçºã«ãããå½±é¿ãããã¨æå¾ ããã¾ãã
ã¯ãã¯ãããã«ã¯æ¤ç´¢ãããè¦æ¨¡ã®ã·ã¹ãã ãå¤æ°åå¨ãããã®å¤ãã¯ããããå®è£ ã«æ¹ä¿®ããããã¨ãæå¾ ããã¦ãããã®ã§ãããã¡ãããã®ããã«ã¯å¤ãã®ãªã½ã¼ã¹ãå¿ è¦ã§ãããå¼ç¤¾ã¯å¹´ããå¹´ä¸ã¨ã³ã¸ãã¢ãåéãã¦ãã¾ãã 大è¦æ¨¡ãªã·ã¹ãã ã®éçºã«ææ¦ãããã¨ã³ã¸ãã¢ãå¤ãã®ã¦ã¼ã¶ã¼ãæ¯ãããµã¼ãã¹ã«é¢ããããã¨ã³ã¸ãã¢ãæè¡ã®åã§ãµã¼ãã¹ããããããã¨ã³ã¸ãã¢ãªã©ãå°ãã§ãèå³ãæãããæ¹ã¯æ¯éã¨ããå¿åãã ããã
*1: https://techlife.cookpad.com/entry/2018/02/10/150709 㨠https://techlife.cookpad.com/entry/2018/12/07/121515
*2:ã¯ãã¯ãããã§ã¯ 2017 å¹´ããã¬ã·ããµã¼ãã¹ã®ã¢ã¼ããã¯ãã£æ¹åãç®çã¨ãããå°å ´ããã¸ã§ã¯ããé²ãã§ãããããã«è²¢ç®ããæå³ãããã¾ãã
*3:Solr ã«ãã¼ã¿ãæã¡è¾¼ã â ã½ã¼ã©ã¼ãã¼ã â ãã·ã®ãã