
HighLoad ++ 2016ã«ã³ãã¡ã¬ã³ã¹ã§ãM-TechéçºãããŒãžã£ãŒã®Vadim Madisonæ°ã¯ã100ã®ãã€ã¯ããµãŒãã¹ãèšå€§ãªæ°ã«æããã·ã¹ãã ãããæ°åã®ãã€ã¯ããµãŒãã¹ãäžè¬çãªå¿ãããããžã§ã¯ããžã®æé·ã«ã€ããŠèªããŸããã
ç§ã®ã¬ããŒãã®ãããã¯ã¯ãããªãå¿ãããããžã§ã¯ãã§æ¬çªç°å¢ã§ãã€ã¯ããµãŒãã¹ãéå§ããæ¹æ³ã§ãã ããã¯äžçš®ã®éçŽãããçµéšã§ãããç§ã¯M-Techã§åããŠããã®ã§ãç§ãã¡ãäœè ã§ãããã«ã€ããŠå°ã話ãããŠãã ããã
èŠããã«ãç§ãã¡ã¯ãããªåºåã«åãçµãã§ããŸã-ç§ãã¡ã¯ãªã¢ã«ã¿ã€ã ã§ãããªãæäŸããŸãã NTV-Plusããã³Match TVã®ãããªãã©ãããã©ãŒã ã§ãã ãããã¯ã5åã§ãªãŸãŒãã«è¡ã30äžäººã®ãŠãŒã¶ãŒã§ãã ããã¯1æéããã300ãã©ãã€ãã®ã³ã³ãã³ãã§ãã ããã¯ãšãŠãèå³æ·±ãä»äºã§ãã ãããã¹ãŠãæäŸããæ¹æ³ã¯ïŒ
ãã®è©±ã¯äœã§ããïŒ ããã¯ãç§ãã¡ãã©ã®ããã«æé·ãããããžã§ã¯ããã©ã®ããã«çºå±ããã©ã®ããã«ãã®éšåã®ããã€ããåèããããããçš®ã®çžäºäœçšã«ã€ããŠã§ããã ãšã«ãããããã¯ãããžã§ã¯ããã¹ã±ãŒã«ã¢ããããããšã§ãããªããªããããã¯ãã¹ãŠãããå€ãã®è² è·ã«èãã顧客ã«ããã«å€ãã®æ©èœãæäŸãããšåæã«ãäž»èŠãªæ©èœã倱ãããšãªãèœã¡ãªãããã§ãã äžè¬çã«ãã¯ã©ã€ã¢ã³ããæºè¶³ããããã«ã ããŠãç§ãã¡ãè¡ã£ãéã«ã€ããŠå°ãã ã©ãããå§ããŸãããã

Dockerã¯ã©ã¹ã¿ãŒã«2å°ã®ãµãŒããŒãããå Žåã®éå§ç¹ãããçš®ã®éå§ç¹ã次ã«ç€ºããŸãã 次ã«ãããŒã¿ããŒã¹ã¯åãã¯ã©ã¹ã¿ãŒã§èµ·åãããŸããã ç§ãã¡ã®ã€ã³ãã©ã¹ãã©ã¯ãã£ã«ã¯ãã®ãããªãã€ã©ã€ãã¯ãããŸããã§ããã ã€ã³ãã©ã¹ãã©ã¯ãã£ã¯æå°éã§ããã

ã€ã³ãã©ã¹ãã©ã¯ãã£ã®åºæ¬ãèŠããšãããã¯ã³ãŒããã¢ã»ã³ããªãªã©ãé ä¿¡ããã·ã¹ãã ãšããŠã®DockerãšTeamCityã§ãã
次ã®ãã€ã«ã¹ããŒã³-ç§ãéã®çãäžãšåŒã¶ãã®-ã¯ããªãæ·±å»ãªãããžã§ã¯ãã®æé·ã§ããã ãã§ã«80å°ã®ãµãŒããŒããã£ããšãã ç¹å¥ãªãã·ã³äžã®ããŒã¿ããŒã¹å°çšã®å°çšã¯ã©ã¹ã¿ãŒãæ§ç¯ãããšãã CEPHããŒã¹ã®åæ£ã¹ãã¬ãŒãžãžã®ç§»è¡ãéå§ãããšãã ãµãŒãã¹ã®çžäºäœçšãåæ€èšããæãæ¥ãã®ã§ã¯ãªãããšèãå§ãããšããç£èŠã·ã¹ãã ãå€æŽããæãæ¥ããšããèãã«è¿ã¥ããŸããã
ãŸããå®éã«ç§ãã¡ãä»æ¥ããã®ã Dockerã¯ã©ã¹ã¿ãŒã«ã¯æ¢ã«æ°çŸã®ãµãŒããŒããããŸã-å®è¡äžã®ãã€ã¯ããµãŒãã¹ã®æ°çŸã ããã§ãã·ã¹ãã ãããŒã¿ãã¹ã¬ãã«ãã·ã¹ãã ã®è«ççåé¢ã¬ãã«ã§ç¹å®ã®ãµãŒãã¹ãµãã·ã¹ãã ã«åå²ãå§ããŠããŸãã ãããã®ãã€ã¯ããµãŒãã¹ãå€ããããšããµãŒãã¹ãããããç解ããããã«ã·ã¹ãã ãåå²ãå§ããŸããã

ç»é¢ã«å³ã衚瀺ãããŸãã ããã¯ãã·ã¹ãã ã®äžéšã§ãã ããã¯ããããªãã¹ã©ã€ã¹ã§ããããã«ãããã®ã§ãã 6ãæåã«RIT ++ã§åæ§ã®ã¹ããŒã ã瀺ããŸããã ãã®åŸãç§ã®æèŠã§ã¯ã17ã®ã°ãªãŒã³ãã€ã¯ããµãŒãã¹ããããŸããã çŸåš28åãããŸãããæŠç®ã§èŠããšãããã¯ã·ã¹ãã ã®1/20ã§ãã ããããã®ã¹ã±ãŒã«ãæ³åã§ããŸãã
詳现
èå³æ·±ãç¹ã®1ã€ã¯ããµãŒãã¹éã®è»¢éã§ãã å€å žçã«ã¯ã茞éã¯å¯èœãªéãå¹ççã§ãªããã°ãªããªããšããäºå®ããå§ãŸããŸãã ãŸããããã«ã€ããŠèããprotobufããã¹ãŠã§ãããšå€æããŸããã
次ã®ããã«ãªããŸããã

Load Balancerãä»ãããªã¯ãšã¹ãã¯ãæåç·ã®ãã€ã¯ããµãŒãã¹ã«å±ããŸãã ããã¯ãããã³ããšã³ãããŸãã¯APIãçŽæ¥æäŸãããµãŒãã¹ã§ãããJSONãä»ããŠæ©èœããŸãã ãŸããå éšãµãŒãã¹ãžã®ãªã¯ãšã¹ãã¯protobufãçµç±ããŸããã
ãããããèªäœã¯éåžžã«è¯ããã®ã§ãã ããã¯æ¬åœã«ã¡ãã»ãŒãžã³ã°ã®ç¹å®ã®ã³ã³ãã¯ãããæäŸããŸãã çŸåšãæå°éã®ãªãŒããŒãããã§ããŒã¿ã®ã·ãªã¢ã©ã€ãºãšãã·ãªã¢ã©ã€ãºãå¯èœã«ããéåžžã«é«éãªå®è£ ããã§ã«ãããŸãã æ¡ä»¶ä»ãã§åæå®ãããèŠæ±ãšèããããšãã§ããŸãã
ãããããã€ã¯ããµãŒãã¹ã®ã³ã³ããã¹ããèŠããšããµãŒãã¹éã§äžçš®ã®ç¬èªãããã³ã«ãååŸããŠããããšãããããŸãã 1ã€ã2ã€ããŸãã¯5ã€ã®ãµãŒãã¹ãããéããåãã€ã¯ããµãŒãã¹ã«å¯ŸããŠã³ã³ãœãŒã«ãŠãŒãã£ãªãã£ãç°¡åã«çºè¡ã§ããŸããããã«ãããç¹å®ã®ãµãŒãã¹ã«ã¢ã¯ã»ã¹ãããããè¿ãããããšã確èªã§ããŸãã 圌ãäœããéãããå Žå-ãããã€ã³ã¯ããŠèŠãŸãã ããã«ããããããã®ãµãŒãã¹ã®ãµããŒãããµããŒãé¢ã§è€éã«ãªããŸãã
ãã段éãŸã§ãããã¯é倧ãªåé¡ã§ã¯ãããŸããã§ãã-å€ãã®ãµãŒãã¹ã¯ãããŸããã§ããã ããã«ãGoogleã®ã¡ã³ããŒã¯gRPCãçºè¡šããŸããã ååãšããŠãåœæã®ç§ãã¡ã®ç®çã®ããã«ã圌ã¯ç§ãã¡ãå¿ èŠãšãããã¹ãŠã®ããšãããŠããããšãããããŸããã ãã£ãããšç§»è¡ããŸããã ãããŠãã -å¥ã®ããšãã¹ã¿ãã¯ã«çŸããŸããã

å®è£ ã®ããªãèå³æ·±ã詳现ãããã«ãããŸãã ããã¯HTTP / 2ã«åºã¥ããŠããŸãã ããã¯ãç®±ããåºããŠããã«åäœãããã®ã§ãã éåžžã«åçãªç°å¢ããªãå Žåãã€ã³ã¹ã¿ã³ã¹ãå€æŽãããªãå Žåãè»ã®åšããååã«é »ç¹ã«ç§»åããªãã§ãã ãããããã¯äžè¬ã«è¯ãããšã§ãã ããã«ãçŸæç¹ã§ã¯ããµãŒããŒãšã¯ã©ã€ã¢ã³ãã®äž¡æ¹ã®èšèªããµããŒãããŠããŸãã
ããŠããã€ã¯ããµãŒãã¹ã®ã³ã³ããã¹ãã§ãããèŠããšã äžæ¹ã§ãç©äºã¯è¯ãããšã§ãããä»æ¹ã§ã¯ãããèªäœãç©äºã§ãã ãã°ãåäžã·ã¹ãã ã«éçŽããããã«ãã°ã®æšæºåãéå§ããå Žåã䟿å©ãªåœ¢åŒã§gRPCãããã°ãçŽæ¥ååŸã§ããªããšããäºå®ã«çŽé¢ããŸããã
ãã®çµæãç¬èªã®ãã®ã³ã°ã·ã¹ãã ãäœæããgRPCã«çµã¿èŸŒããšããçµè«ã«éããŸããã 圌女ã¯gRPCãä»ããŠçºè¡ãããã¡ãã»ãŒãžã®è§£æãè¡ããããããæãã€ããã®ã§ããããéåžžã®ãã®ã³ã°ã·ã¹ãã ã«å ¥ããããšãã§ããŸããã ããã«ããµãŒãã¹ãšãã®ãµãŒãã¹ã®ã¿ã€ããæåã«èšè¿°ããŠããã³ã³ãã€ã«ããç¶æ³ã«å ããŠããµãŒãã¹éã®äŸåé¢ä¿ãå¢å ããŸãã ãã€ã¯ããµãŒãã¹ã®å Žåãããã¯åé¡ã§ãããããŒãžã§ãã³ã°ã®è€éããšåãã§ãã
ããããæ¢ã«æšæž¬ããããã«ãæçµçã«ã¯ãJSONã«ã€ããŠèãå§ãããšããçµè«ã«éããŸããã ãããŠãç§ãã¡ã¯é·ãéãããã€ãã®ã³ã³ãã¯ããªæ¡ä»¶ä»ããã€ããªãããã³ã«ã®åŸãåãããšã«ã€ããŠæžããDailyMotioné£äžããã®èšäºã«åºããããŸã§ãçªç¶JSONã«æ»ããšã¯ä¿¡ããŠããŸããã§ããã JSONã誰ããããã調çããæ¹æ³ãç¥ã£ãŠããŸãããªãç§ãã¡ã¯èªåèªèº«ã®ããã«è¿œå ã®å°é£ãäœæããã®ã§ããïŒã

ãã®çµæãç¹å®ã®å®è£ ã§gRPCããJSONã«åŸã ã«ç§»è¡ãå§ããŸããã ã€ãŸããã¯ããHTTP / 2ãæ®ããJSONã§åäœããã®ã«ååãªéãã§å®è£ ããŸããã
ç§ãã¡ãæã£ãŠãããã¹ãŠã®ãã³ãæã«å ¥ããŸããã cURLãä»ããŠãµãŒãã¹ã«ã¢ã¯ã»ã¹ã§ããŸãã ãã¹ã¿ãŒã¯Postmanã䜿çšããŠãããããããæ£åžžã«æ©èœããŠããŸãã ãããã®ãµãŒãã¹ã䜿çšããã©ã®æ®µéã§ãããã¹ãŠãç°¡åã«ãªããŸããã ããã¯ãäžæ¹ã§ã¯ç©è°ãéžã決å®ã§ãããä»æ¹ã§ã¯ãã¡ã³ããã³ã¹ã®é¢ã§éåžžã«åœ¹ç«ã¡ãŸãã
æŠããŠãJSONãèŠããšãçŸæç¹ã§ããã瀺ãããšãã§ããå¯äžã®ãã€ãã¹ç¹ã¯ããã®èšè¿°ã®ã³ã³ãã¯ããã®æ¬ åŠã§ãã ãããã®30ïŒ ã¯ãçµ±èšã«ãããšãåãMessagePackãŸãã¯ä»ã®äœããšã®å·®ã§ãããå®éã枬å®å€ã«ãããšãå·®ã¯ããã»ã©å€§ãããªãããµããŒããããŠããã·ã¹ãã ã«ã€ããŠè©±ããšãããããã»ã©é倧ã§ã¯ãããŸããã
ããã«ãJSONãžã®ç§»è¡ã«äŒŽããè¿œå ã®ãã³ãè¿œå ãããŸããã ããšãã°ããããã³ã«ã®ããŒãžã§ã³ç®¡çãªã©ã ããæç¹ã§ããããã³ã«ã®æ°ããããŒãžã§ã³ã説æããŠããã®ãšåãprotobufãéããŠç¶æ³ãçºå±ãå§ããŸããã ãããã£ãŠããã®ç¹å®ã®ãµãŒãã¹ã®æ¶è²»è ã§ãã顧客ãããã«ç§»åããå¿ èŠããããŸãã æ°çŸã®ãµãŒãã¹ãããå Žåããããã®10ïŒ ã§ãã移åããã¯ãã§ãã ããã¯ãã§ã«å€§ããªã«ã¹ã±ãŒãå¹æã§ãã 1ã€ã®ãµãŒãã¹ã§å€æŽããããå¥ã®10ãåå®è¡ããå¿ èŠããããŸãã
ãã®çµæããã®ãµãŒãã¹ã®éçºè ã5çªç®ã6çªç®ã7çªç®ã®ããŒãžã§ã³ããªãªãŒã¹ãããšãã«ç¶æ³ãçºçãå§ããŸããããå®éã«ã¯ãé¢é£ãããµãŒãã¹ã®éçºè ã«ã¯æéãšåªå é äœããããããå®çšŒåã®è² è·ã¯äŸç¶ãšããŠ4çªç®ã«ãªããŸãã åã«ãµãŒãã¹ãç¶ç¶çã«åæ§ç¯ããããæ°ããããŒãžã§ã³ã®ãããã³ã«ã«ç§»è¡ãããããããšã¯ã§ããŸããã å®éã«æ°ããããŒãžã§ã³ããªãªãŒã¹ãããããšãå€æããŸããããéèŠã¯ãããŸããã ããããå€ãããŒãžã§ã³ã®ãã°ã¯ãããã€ãã®ãããŸããªæ¹æ³ã§å®è£ ããå¿ èŠããããŸãã ããã¯ãµããŒããè€éã«ããŸããã
ãã®çµæããããã³ã«ããŒãžã§ã³ã®äœæãäžæ¢ãããšããçµè«ã«éããŸããã ããããã£ãè¿œå ã§ããåºæ¬ããŒãžã§ã³ãä¿®æ£ããŸããããéåžžã«éãããå¶éå ã§ãã ãããŠãæ¶è²»è ãµãŒãã¹ã¯JSONã¹ããŒã ã䜿çšãå§ããŸããã
ããã¯æ¬¡ã®ããã«ãªããŸãã

1ã2ã3ã®ä»£ããã«ãããŒãžã§ã³1ãšããã«é©çšãããã¹ããŒã ããããŸãã

以äžã¯ãåœç€Ÿã®ãµãŒãã¹ããã®å žåçãªåçã§ãã ããã¯ã³ã³ãã³ããããŒãžã£ãŒã§ãã 圌ã¯æŸéæ å ±ãæäŸããŸããã ããã¯ãããšãã°ãæ¶è²»è ã®1人ã®å³ã§ãã

ããã§æãèå³æ·±ãè¡ã¯äžçªäžã®è¡ã§ãå¿ èŠãªãããã¯ããããŸãã èŠããšããã®ãµãŒãã¹ã¯å®éã«ãã®ãã¹ãŠã®ããŒã¿ã®4ã€ã®ãã£ãŒã«ãïŒidãcontentãdateãstatusïŒã ããå¿ èŠãšããŠããããšãããããŸãã ãã®ã¹ããŒã ãå®éã«é©çšããå Žåãæçµçã«é¡§å®¢ãµãŒãã¹ã¯ãã®ããŒã¿ã®ã¿ãå¿ èŠãšããŸãã

ãããã¯ããããã³ã«ã®æåã®ããŒãžã§ã³ã®ãã¹ãŠã®ããªãšãŒã·ã§ã³ã®ãã¹ãŠã®ããŒãžã§ã³ã«å®éã«ãããŸãã ããã«ãããæ°ããããŒãžã§ã³ãžã®ç§»è¡ãç°¡åã«ãªããŸããã ç§ãã¡ã¯æ°ãããªãªãŒã¹ããªãªãŒã¹ãå§ããããããžã®æ¶è²»è ã®ç§»è¡ã¯å€§å¹ ã«ç°¡çŽ åãããŸããã
ãã€ã¯ããµãŒãã¹ãããã³äžè¬çã«ã¯ã·ã¹ãã ã«ã€ããŠè©±ããšãã«çãã次ã®éèŠãªç¬éã ãã€ã¯ããµãŒãã¹ã§ã¯ãäœããã匷ããŠéããšæããã ãã§ãã ãããã¯ãã·ã¹ãã ãäžå®å®ã«ãªãç¶æ³ã§ãã
1-2ãµãŒãã¹ã®ã³ãŒã«ãã§ãŒã³ãããå Žåãç¹å¥ãªåé¡ã¯ãããŸããã ã¢ããªã·ãã¯ã¢ããªã±ãŒã·ã§ã³ãšåæ£ã¢ããªã±ãŒã·ã§ã³ã®éã«ã°ããŒãã«ãªéãã¯ãããŸããã ãããããã§ãŒã³ã5ã7ã«æé·ãããšãããæç¹ã§äœããèœã¡ãŸããã ãªãèœã¡ãã®ããã©ããããããã®ããããªãã¯æ¬åœã«ç¥ããŸããã ãããã°ã¯éåžžã«å°é£ã§ãã ãããã¬ããªã³ã«ããã¢ããªã·ãã¯ã¢ããªã±ãŒã·ã§ã³ã®ã¬ãã«ã§ãæé ãå®è¡ããŠãã®ãšã©ãŒãèŠã€ãã£ãå Žåããããã¯ãŒã¯ã®äžå®å®æ§ãè² è·ãããã£ãç¶æ ã§ã®äžå®å®ãªããã©ãŒãã³ã¹ãªã©ããããŸãã ãããŠããã®ãããªãã®-ããããããŒãã®æãåããåæ£ã·ã¹ãã ã§ã¯ãéåžžã«é¡èã«ãªããŸãã

ãããããæåã¯å€å žçãªæ¹æ³ã§è¡ã£ãã ç§ãã¡ã¯ããã¹ãŠãç£èŠããäœãã©ãã§å£ããããç解ããã©ãã«ãããŠè¿ éã«å¯ŸåŠããããšããããšã«ããŸããã ãã€ã¯ããµãŒãã¹ããã¡ããªãã¯ãéä¿¡ããããããåäžã®ããŒã¿ããŒã¹ã«åéãå§ããŸããã Diamondãä»ããŠãã·ã³ã®ããŒã¿ãåéãå§ããŸãããããã¯ãAdvisorãä»ããŠè¡ãããŸãã Dockerã³ã³ãããŒã«é¢ããæ å ±ã®åéãéå§ããããããã¹ãŠãInfluxDBã«ããŒãžããŠãGrafanaã§ããã·ã¥ããŒããæ§ç¯ããŸããã

ãŸããã€ã³ãã©ã¹ãã©ã¯ãã£ã«ã¯ããã«3ã€ã®ãããã¯ããããåŸã ã«æé·ããŠããŸãã
ã¯ããç§ãã¡ã¯ç§ãã¡ã«äœãèµ·ãã£ãŠããããããæèããããã«ãªããŸããã äœãããã©ãã©ã«ãªã£ããšããäºå®ã«ãç§ãã¡ã¯ããè¿ éã«å¯Ÿå¿ãå§ããŸããã ããããããã¯ããããé¢ããããšãæ¢ããŸããã§ããã
å¥åŠãªããšã«ããã€ã¯ããµãŒãã¹ã¢ãŒããã¯ãã£ã®äž»ãªåé¡ã¯ãäžå®å®ãªãµãŒãã¹ãããããšã§ãã åäœããŸãããåäœããŸãããããã«ã¯å€ãã®çç±ããããŸãã ãµãŒãã¹ãéè² è·ã«ãªããè¿œå ã®è² è·ãéä¿¡ãããŸã§ããã°ããã®éãµãŒãã¹ã¯åæ¢ããŸãã ãã°ããããŠã圌ããã¹ãŠã«ãµãŒãã¹ãæäŸããŠããªããšããäºå®ã«ãããè² è·ã圌ããèœã¡ã圌ã¯åã³ãµãŒãã¹ãéå§ããŸãã ãã®ãããªè·³èºã¯ããã®ãããªã·ã¹ãã ãç¶æããã®ãéåžžã«é£ãããäœãæªãã®ããç解ããã®ãé£ãããšããäºå®ã«ã€ãªãããŸãã
ãã®çµæã次ã®ããã«ãžã£ã³ããããããããã®ãµãŒãã¹ãèœã¡ãæ¹ãè¯ããšããçµè«ã«åŸã ã«éããŸããã ãã®ç解ã«ããããµãŒãã¹ã®å®è£ æ¹æ³ã«å¯Ÿããã¢ãããŒããå€ãå§ãããšããäºå®ã«è³ããŸããã
éèŠãªãã€ã³ãã®æåã åãµãŒãã¹ãžã®çä¿¡ãªã¯ãšã¹ãã«å¶éãå°å ¥ãå§ããŸããã åãµãŒãã¹ã¯ã顧客ã«ã©ãã ããµãŒãã¹ãæäŸã§ããããç¥ãå§ããŸããã 圌ã¯ã©ã®ããã«ãããç¥ã£ãŠããã®ããå°ãåŸã§èª¬æããŸãã ãã®å¶éãè¶ ããŠãããããã®å¢çã®è¿ãã«ãããã¹ãŠã®èŠæ±ã¯ã圌ãåãå ¥ããã®ããããŸãã æ£çŽãª503 Service Unavailableãçºè¡ããŸãã 圌ã«å¯ŸåŠãã人ã¯èª°ã§ããå¥ã®ããŒããéžæããå¿ èŠãããããšãç解ããŠããŸã-ãã®ããŒãã¯ãµãŒãã¹ãæäŸã§ããŸããã
ãããã£ãŠãã·ã¹ãã ã«äœãåé¡ãããå Žåããªã¯ãšã¹ãæéãççž®ããŸãã äžæ¹ããã®å®å®æ§ã¯åäžããŸãã
第äºã®ç¬éã ã¬ãŒãå¶éãå®å ãµãŒãã¹ã®åŽã«ããå Žåãã©ãã§ãå°å ¥ãå§ãã2çªç®ã®ãã¿ãŒã³ã¯ãµãŒããããã¬ãŒã«ãŒã§ãã ããã¯ã倧ãŸãã«èšãã°ãã¯ã©ã€ã¢ã³ãã«å®è£ ãããã¿ãŒã³ã§ãã
ãµãŒãã¹Aã¯ãå¯èœãªéãã¢ã¯ã»ã¹ãã€ã³ããããšãã°ãµãŒãã¹Bã®4ã€ã®ã€ã³ã¹ã¿ã³ã¹ãæã£ãŠããŸããããã§ã圌ã¯ã¬ãžã¹ããªã«è¡ããããããã®ãµãŒãã¹ã®ã¢ãã¬ã¹ãæããŠãã ããããšèšããŸããã ãããã4åæã«å ¥ããŸããã ç§ã¯æåã®ãã®ã«è¡ããŸããã圌ã¯ãã¹ãŠã倧äžå€«ã ãšåœŒã«çããŸããã ãµãŒãã¹ã¯ãã¯ãããšããŒã¯ãããŠããã®ã§ãããã«è¡ãããšãã§ããŸãã ã©ãŠã³ãããã³ã«ãããšã圌ã¯èšŽããã°ããŸããŸãã 第äºã«è¡ã£ãã圌ã¯é©åãªæéã«åœŒã«çããªãã£ãã ããã ãã§ãããã°ããã®é圌ãçŠæ¢ãã次ãžé²ã¿ãŸãã ããã¯ãããšãã°ãçç±ã«é¢ä¿ãªããäžæ£ãªããŒãžã§ã³ã®ãããã³ã«ãè¿ããŸãã 圌ã圌ãçŠæ¢ããŸãã 4çªç®ã«é²ã¿ãŸãã
ãã®çµæããµãŒãã¹ã®50ïŒ ãåŸããã圌ãã¯æ¬åœã«åœŒãã¯ã©ã€ã¢ã³ãã«ãµãŒãã¹ãæäŸããã®ãå©ããããšãã§ããŸãã 圌ã¯ãããäºã€ã«è¡ããŸãã ãªãããã®çç±ã§åœŒã«åããªãã£ãäºäººã¯ããã°ããçŠæ¢ããŸãã
ããã«ãããäœæ¥å šäœã®å®å®æ§ãå€§å¹ ã«åäžãããããšãã§ããŸããã ãµãŒãã¹ã«äœãåé¡ããããŸãããããæ®åœ±ãããµãŒãã¹ãæ®åœ±ããããšããã¢ã©ãŒããçºçããããã«äœãééã£ãŠããã®ããèŠã€ããŸãã
Circuit Breakerãã¿ãŒã³ã®å°å ¥ã«å¯Ÿå¿ããŠãã€ã³ãã©ã¹ãã©ã¯ãã£ã«ãã1ã€ãããŸã-ããã¯Hystrixã§ãã

Netflixã®ã¹ã¿ããã¯ããã®ãã¿ãŒã³ã®ãµããŒããå®è£ ããã ãã§ãªããã·ã¹ãã ã«åé¡ããããã©ãããç解ããæ¹æ³ãæ確ã«ããŸããã

ããã§ããã®åã®ãµã€ãºã¯ãä»ã®ãŠãŒã¶ãŒãšæ¯èŒãããã©ãã£ãã¯éã瀺ããŠããŸãã è²ã¯ãã·ã¹ãã ã®çšåºŠã瀺ããŸãã ç·ã®åãããå Žåã¯ãããããããã¹ãŠãé 調ã§ãã èµ€ã®å Žå-ãã¹ãŠããã©è²ã§ã¯ãããŸããã
ãµãŒãã¹ãå®å šã«æ®åœ±ããå¿ èŠããããšãã¯ããã®ããã«èŠããŸãã ã¹ã€ãããæ©èœããŸããã

ç§ãã¡ã¯ãã·ã¹ãã ãå€å°ãªããšãå®å®ããŠããããšãéæããŸããã åãµãŒãã¹ã®ã€ã³ã¹ã¿ã³ã¹ãå°ãªããšã2ã€ãããããã©ã¡ãããèµ·åããŠåãæ¿ããããšãã§ããŸãã ããããããã¯ç§ãã¡ã®ã·ã¹ãã ã§äœãèµ·ãã£ãŠããã®ããç解ãããã®ã§ã¯ãããŸããã§ããã ãªã¯ãšã¹ãã®å®è¡äžã«éäžã§äœããèœã¡ãå Žåãã©ã®ããã«ãããç解ããã®ã§ããïŒ
æšæºã¯ãšãªã¯æ¬¡ã®ãšããã§ãã

ãã®ãããªå®è¡ã®ãã§ãŒã³ã ãŠãŒã¶ãŒããæåã®ãµãŒãã¹ã«å¯ŸããèŠæ±ãæ¥ãŠã次ã«2çªç®ã®ãµãŒãã¹ããã3çªç®ãš4çªç®ã®ãã©ã³ãã«åå²ãã2çªç®ã®ãµãŒãã¹ãžã®èŠæ±ãæ¥ãŸããã

ãã ããã©ã³ãã®1ã€ãããããããŸããã çç±ã¯æ¬åœã«æ確ã§ã¯ãããŸããã ãã®ç¶æ³ã«çŽé¢ããããã§äœããã¹ãããç¶æ³ã®å¯èŠæ§ãã©ã®ããã«æ¹åã§ããããèãå§ãããšããAppdashã®ãããªãã®ã«åºäŒããŸããã ããã¯ãã¬ãŒã¹ãµãŒãã¹ã§ãã

次ã®ããã«ãªããŸãã

ç§ã¯ããã«èšããªããã°ãªããªããããã¯ããã ã£ããã©ãããç解ããããã«ãè©ŠããŠã¿ãããšã§ããã ç§ãã¡ã®ã·ã¹ãã ã«å®è£ ããã®ãæãç°¡åã§ããããã®é ã«ã¯ãGoã«ãã£ãããšåãæ¿ããŠããããã§ãã Appdashã«ã¯ãæ¥ç¶ããæºåãæŽã£ãã©ã€ãã©ãªããããŸããã ã¯ãããã®ããšã¯ç§ãã¡ãå©ããŸãããå®è£ èªäœã¯ç§ãã¡ã«ã¯ããŸãé©ããŠããŸããã

ãã®åŸãAppdashã®ä»£ããã«ãZipkinãå ¥æããŸããã ããã¯ãTwitterã®äººãã¡ããã£ãããšã§ãã 次ã®ããã«ãªããŸãã

ç§ã«ã¯ããå°ãã¯ã£ããããŠããããã§ãã ããã§ãç¹å®ã®æ°ã®ãµãŒãã¹ãããããšãããããŸãã ãªã¯ãšã¹ãããã®ãã§ãŒã³ãã©ã®ããã«ééãããããã®ãªã¯ãšã¹ããåãµãŒãã¹ã§ã©ãã ãé£ãå°œãããããã確èªããŸãã äžæ¹ã§ã¯ãããã€ãã®å ±éã®æéãšãµãŒãã¹ã«ããåºåããããŸããä»æ¹ã§ã¯ãåãããã«ãµãŒãã¹å ã§äœãèµ·ãã£ãŠãããã«ã€ããŠã®æ å ±ãè¿œå ããããšã誰ãæ°ã«ããŸããã
ã€ãŸããããçš®ã®ãã€ããŒããããŒã¿ããŒã¹ãžã®ã¢ã¯ã»ã¹ããã¡ã€ã«ã·ã¹ãã ããã®äœãã®æžç®ããã£ãã·ã¥ãžã®ã¢ã¯ã»ã¹-ãããã¯ãã¹ãŠåãæ¹æ³ã§è¿œå ããã³è¡šç€ºã§ãããªã¯ãšã¹ãã§ã¯ãã®ãªã¯ãšã¹ãã«æãæéãè¿œå ã§ããŸãã ãã®è»¢éãå¯èœã«ããã®ã¯ãTraceIDã䜿çšããããšã§ãã 圌ã«ã€ããŠããå°ã話ããŸãããã

ããããç¹å®ã®ãªã¯ãšã¹ãã§äœãèµ·ãã£ãŠããã®ããç¹å®ã®ã¯ã©ã€ã¢ã³ãã«çªç¶èœã¡ãçç±ãç解ãå§ããçç±ã§ãã ãã¹ãŠãé 調ã§ãçªç¶èª°ããééã£ãŠããŸãã ç¹å®ã®åºæ¬çãªã³ã³ããã¹ãã確èªãããµãŒãã¹ã§äœãèµ·ãã£ãŠããã®ããç解ãå§ããŸããã

å°ãåãŸã§ããã¬ãŒã¹ã·ã¹ãã çšã®æšæºãéçºãããŸããã ãã®å®è£ ãå¯èœãªéãç°¡åã«ããããã«ãã¯ã©ã€ã¢ã³ãAPIãšã¯ã©ã€ã¢ã³ãã©ã€ãã©ãªãå®è£ ããæ¹æ³ã«ã€ããŠããã¬ãŒã¹ã·ã¹ãã ã®äž»èŠãªãµãã©ã€ã€éã§äœããã®çš®é¡ã®åæããããŸãã çŸåšãã»ãšãã©ãã¹ãŠã®äž»èŠèšèªã«å¯ŸããŠOpentracingã«ããå®è£ ãæ¢ã«ãããŸãã å®å šã«äœ¿çšã§ããŸãã
ç§ãã¡ã¯ãã©ã®ãµãŒãã¹ãçªç¶ã¯ã©ã€ã¢ã³ãã«ãµãŒãã¹ãæäŸã§ããªãã£ãã®ããç解ããããšãåŠã³ãŸããã äžéšã®éšåãéããªã£ãŠããããšãããããŸããããã®çç±ã¯å¿ ãããæ確ã§ã¯ãããŸããã ã³ã³ããã¹ããäžååã§ãã
ãã®ã³ã°ããããŸãã ã¯ããããã¯ããªãæšæºçãªãã®ã§ããããã¯ELKã§ãã ãã¶ãç§ãã¡ã®å°ããªããªãšãŒã·ã§ã³ã§ã

Logstashã®åœ¢åŒã§ããŒããä»ããŠçŽæ¥åéããããšã¯ãããŸããã ãŸãããããSyslogã«æž¡ããŸããSyslogã䜿çšããŠãåéãã·ã³ã§ãããéçŽããŸãã ãããããé ãè¿œã£ãŠElasticSearchãšKibanaã«é 眮ããŸãã æ¯èŒçæšæºçãªãã®ã ããªãã¯ã¯äœã§ããïŒ

äºå®ãå¯èœãªéããããããã®ç¹å®ã®ãªã¯ãšã¹ãã«æ¬åœã«é¢é£ããŠããããšãæ¬åœã«ããã£ãŠãããšããã§ãç»é¢ã«Zipkinã§è¡šç€ºããTraceIDããããã®ãã°ã«è¿œå ãå§ããŸããã
ãã®çµæãç¹å®ã®ãŠãŒã¶ãŒã®å®å šãªå®è¡ã³ã³ããã¹ãããã°ã®Kibanaã®ããã·ã¥ããŒãã«è¡šç€ºãããŸãã æããã«ããµãŒãã¹ãprodã«ãªã£ãå Žåã¯ãæ¡ä»¶ä»ãã§ãã§ã«æ©èœããŠããŸãã å¿ èŠã«å¿ããŠã圌ã¯èªåãã¹ãã«åæ Œãããã¹ã¿ãŒã¯ãã§ã«åœŒãèŠãŠããŸãã åäœããã¯ãã§ãã 圌ãç¹å®ã®ç¶æ³ã§åããŠããªãå Žåãæããã«ãããã€ãã®åææ¡ä»¶ããããŸããã ãã®è©³çŽ°ãªãã°ã®ãããã®åææ¡ä»¶ã¯ãç¹å®ã®èŠæ±ã®ç¹å®ã®ãã¬ãŒã¹ã§ãã®ãããªãã£ã«ã¿ãªã³ã°ãè¡ãããšã§ç¢ºèªã§ãããã®ç¶æ³ã§æ£ç¢ºã«äœãééã£ãŠããããããè¿ éã«ç解ããã®ã«åœ¹ç«ã¡ãŸãã ãã®çµæãåé¡ã®åå ã«å¯Ÿããç解ãéåžžã«æ·±å»ã«ãªããŸããã
次ã®èå³æ·±ãç¹ã åçãããã°modãå°å ¥ããŸããã ååãšããŠãä»ã§ã¯ãã®ãããªèšå€§ãªæ°ã®ãã°ã¯ãããŸãã-çŽ100ã150ã®ã¬ãã€ããæ£ç¢ºãªæ°ã¯èŠããŠããŸããã ãã ããããã¯åºæ¬çãªãã®ã³ã°ã¢ãŒãã§ãã äžè¬çã«è¶ 詳现ã«èšè¿°ããå Žåããã©ãã€ãã«ãªããŸãã ãããã®åãæ±ãã¯ãã¡ããã¡ãé«ãã§ãããã
ãããã£ãŠãäœããã®åé¡ãããããšãããã£ãããç¹å®ã®ãµãŒãã¹ã«ç§»åããdebug mod APIãä»ããŠããããæå¹ã«ããŠãäœãèµ·ããããç£èŠããŸãã æã ãæåã«äœãèµ·ããããèŠãŸãã æã ããµãŒãã¹ããªãã«ããã«åé¡ãäœæãããµãŒãã¹ãæ®åœ±ãããã®äžã§ãããã°modããªã³ã«ãããšããã§ã«äœãåé¡ãªã®ããããããŸãã
ãã®çµæãããã¯ELKã¹ã¿ãã¯ã®èŠ³ç¹ããéåžžã«åœ¹ç«ã¡ãŸããELKã¹ã¿ãã¯ã¯éåžžã«è²ªæ¬²ã§ãã äžéšã®éèŠãªãµãŒãã¹ã§ã¯ãããã«ãšã©ãŒãéçŽããŸãã ã€ãŸãããµãŒãã¹èªäœã¯ããããéåžžã«é倧ãªééãã§ããããšãäžçšåºŠã®é倧ã§ããããšãç解ãããã¹ãŠãSentryã«ãã³ãããŸãã

圌女ã¯ããããã®ãšã©ãŒãéçŽããç¹å®ã®ã¡ããªãã¯ã«åŸã£ãŠèŠçŽããåºæ¬çãªãã®ã®ãã£ã«ã¿ãŒãäœæã§ããã»ã©è³¢ãã§ãã ãããå€ãã®ãµãŒãã¹ã§äœ¿çšããŠããŸãã ãããŠãç§ãã¡ã¯ã¢ããªã·ãã¯ãªã¢ããªã±ãŒã·ã§ã³ãæã£ãŠãããšãããããã䜿ãå§ããŸããã çŸåšãç¹ã«ãã€ã¯ããµãŒãã¹ã¢ãŒããã¯ãã£äžã®ããã€ãã®ãµãŒãã¹ã玹ä»ããŠããŸãã
æãèå³æ·±ãããšã ãã®ãããã³å šäœãã©ã®ããã«ã¹ã±ãŒãªã³ã°ããŸããïŒ ããã§ãããã€ãã®çŽ¹ä»ãããå¿ èŠããããŸãã ãããžã§ã¯ãã«åœ¹ç«ã€ãã·ã³ã®ããããã«ã€ããŠãäžçš®ã®ãã©ãã¯ããã¯ã¹ã®ããã«æ±ãããŸãã

ãªãŒã±ã¹ãã¬ãŒã·ã§ã³ã·ã¹ãã ããããŸãã ãããããå§ããŸããã ããã§ã¯ãããŸããããå®éã«ã¯ã¹ã¯ãªããã䜿çšããŠAnsibleããå§ããŸããã ããæç¹ã§ãããã¯ååã§ã¯ãããŸããã§ããã ãã®æãŸã§ã«ããã§ã«Nomadã®ããããŒãžã§ã³ããããŸããã ç§ãã¡ã¯èŠãã圌女ã¯åœŒå¥³ã®ã·ã³ãã«ãã§ç§ãã¡ãè²·åããã ããããç§ãã¡ãä»ã«ç§»ãããšãã§ãããã®ã§ãããšç§ãã¡ã¯æ±ºããŸããã

éäžã§ãConsulã¯ãµãŒãã¹çºèŠã®ã¬ãžã¹ããªãšããŠåœŒå¥³ãšå ±ã«çŸããŸããã ãŸããVaultã«ã¯ããã¹ã¯ãŒããããŒãGitã«ä¿åã§ããªããã¹ãŠã®ç§å¯ãªã©ãç§å¯ããŒã¿ãä¿åãããŠããŸãã
ãããã£ãŠããã¹ãŠã®ãã·ã³ãæ¡ä»¶ä»ãã§åãã«ãªãããšãå€æããŸããã ãã·ã³ã«ã¯Dockerãããããã®äžã«ConsulãšãŒãžã§ã³ããNomadãšãŒãžã§ã³ãããããŸãã ããã¯ãæŠããŠãå®æãããã·ã³ã§ãããé©åãªã¿ã€ãã³ã°ã§1ã€ãã€åãåºããŠã³ããŒããããšãã§ããŸãã ããããäžèŠã«ãªã£ãããå»æ¢ããããšãã§ããŸãã ããã«ãã¯ã©ãŠããããå Žåã¯ãããŒã¯æã«ãã·ã³ãäºåã«æºåããŠãé»æºãå ¥ããããšãã§ããŸãã ãããŠãè² è·ãèœã¡ãããé»æºãåããŸãã ããã¯éåžžã«å€§ããªç¯çŽã§ãã

ããæç¹ã§ãããŒãããã¯æé·ããŸããã ç§ãã¡ã¯Kubernetesã«ç§»ããConsulã¯ãã¹ãŠã®çµæã䌎ããµãŒãã¹ã®äžå¿çãªæ§æã·ã¹ãã ã®åœ¹å²ãæããå§ããŸããã
èªåçã«ã¹ã±ãŒãªã³ã°ããããã«ãããçš®ã®ã¹ã¿ãã¯ãããããšã«æ°ä»ããŸããããããã©ããã£ãŠããã®ïŒ
æåã®ã¹ããããã¡ã¢ãªãããã»ããµããããã¯ãŒã¯ã®3ã€ã®ç¹æ§ã«ããã€ãã®å¶éãå°å ¥ããŸããã

ãããã®å€ããšã«3ã€ã®ã°ã©ããŒã·ã§ã³ãèšé²ããŸãããã¬ã³ã¬ãããã€ãåããŸããäŸãšããŠïŒ

R3-C2-N1ãç¹å®ã®ãµãŒãã¹ãå¶éããã»ãã®å°ãã®ãããã¯ãŒã¯ãããå°ãã®ããã»ããµã倧éã®ã¡ã¢ãªãæäŸããŸããã倧é£ããµãŒãã¹ããããŸãã
ããŒã¢ããã¯ãå°å ¥ããŸããããã¯ãã·ã¹ãã ã«æ¢ã«ååšããåºç¯å²ã®ç¹å®ã®å€ãåçã«ãããããšãã§ãããããææ決å®ãµãŒãã¹ãšåŒã³ãŸããçŸæç¹ã§ã¯ããããã®å€ã¯ã»ãŒæ¬¡ã®ãšããã§ã

ãå®éãC4ãR4ã¯ãŸã ãããŸããããããã¯ãããã®æšæºãå®å šã«è¶ ããå€ã§ãããããã¯åå¥ã«äº€æžãããŸãã
次ã®ããã«ãªããŸãã

次ã®æºå段éããã®ãµãŒãã¹ãæã€ã¹ã±ãŒã©ããªãã£ã®ã¿ã€ããæ€èšããŠããŸãã
æãåçŽãªã®ã¯ããµãŒãã¹ãå®å šã«ç¬ç«ããŠããå Žåã§ãããã®ãµãŒãã¹ã¯çŽç·çã«ãªãããã§ããŸãã 2åã®ãŠãŒã¶ãŒãæ¥ãŸãã-2åã®ã€ã³ã¹ã¿ã³ã¹ãèµ·åããŸãããããªãã¯åã³å æ°ã§ãã
2çªç®ã®ã¿ã€ãã¯ãã¹ã±ãŒã©ããªãã£ãå€éšãªãœãŒã¹ã«äŸåããå Žåã§ãã倧ãŸãã«èšã£ãŠããã®ãµãŒãã¹ã¯ããŒã¿ããŒã¹ã«å«ãŸããŠããŸããããŒã¹ã«ã¯ãç¹å®ã®æ°ã®é¡§å®¢ã«ãµãŒãã¹ãæäŸããç¹å®ã®æ©èœããããŸãããããèæ ®ããªããã°ãªããŸãããã·ã¹ãã ãäœäžãå§ããŠã€ã³ã¹ã¿ã³ã¹ãè¿œå ããããšãã§ããªããªãææãç解ããããåã«çŸåšã©ã®çšåºŠå®è¡ã§ããããåã«ç解ããå¿ èŠããããŸãã
ãããŠã3çªç®ã®æãèå³æ·±ããªãã·ã§ã³ã¯ãå€éšã·ã¹ãã ã«å¶éãããŠããå Žåã§ããäŸãšããŠãå€éšè«æ±ã圌ã¯500ãè¶ ãããªã¯ãšã¹ããåŠçããªãããšãç¥ã£ãŠããŸãããããŠãããšãããªãã100ã®ãµãŒãã¹ãç«ã¡äžãããšããŠããè«æ±ã®ããã®ãã¹ãŠã®500ãªã¯ãšã¹ãããããŠããã«ã¡ã¯ïŒ
ãããã®å¶éãèæ ®ããå¿ èŠããããŸãããã®ããããµãŒãã¹ãã©ã®ã¿ã€ãã®ãµãŒãã¹ã«å±ããŠããããç解ããé©åãªã¿ã°ãä»ããŠããã€ãã©ã€ã³ã§ã©ã®ããã«åäœãããã確èªããŸããã

ããã©ã«ãã§ã¯ãCIãµãŒããŒã§åéããããã€ãã®åäœãã¹ããéå§ããŸããããã¹ãç°å¢ã§ã¯ãçµ±åãã¹ãã«åæ Œãããã¹ã¿ãŒãäœãããã§ãã¯ããŸããã次ã«ãéçšåã®ã¹ãã¬ã¹ãã¹ãã«é²ã¿ãŸããã

æåã®ã¿ã€ãã®ãµãŒãã¹ãããå Žåãã€ã³ã¹ã¿ã³ã¹ãååŸãããã®éé¢ãããç°å¢ã§å®è¡ããŠãæå€§è² è·ãäžããŸããããã€ãã®ã©ãŠã³ããè¡ããååŸããå€ã®æå°æ°ãååŸããŸãã InfluxDBã«é 眮ãããããååãšããŠãã®ãµãŒãã¹ã§å¯èœãªå¶éã§ãããšèšããŸãã
2çªç®ã®ã¿ã€ãã®ãµãŒãã¹ãããå Žåã¯ãã·ã¹ãã ã®å£åãå§ãŸããŸã§ããããã®ã€ã³ã¹ã¿ã³ã¹ãäžå®éãã€å¢åããŠå®è¡ããŸããã©ããããéãããé ãããè©äŸ¡ããŸããããã§çµè«ãå°ãåºããŸããã·ã¹ãã ã®ç¹å®ã®è² è·ãããã£ãŠããå Žåãããã§ååã§ããïŒå¿ èŠãªåšåº«ã¯ãããŸããïŒååšããªãå Žåã¯ããã®æ®µéã§ãã§ã«èŠåãåºãããã®ãµãŒãã¹ãå®çšŒåã§ãªãªãŒã¹ããŸãããéçºè ã«æ¬¡ã®ããã«äŒããŸãããã¿ããªãäœããç Žãå¿ èŠãããããããã§ãªããã°ãã®ãµãŒãã¹ãããç·åœ¢ã«æ¡åŒµã§ãããããªããŒã«ããããå°å ¥ããå¿ èŠããããŸããã

3çªç®ã®ã¿ã€ãã®ãµãŒãã¹ã«ã€ããŠè©±ããŠããå Žåããã®å¶éãç¥ã£ãŠããã®ã§ããµãŒãã¹ã®ã³ããŒã1ã€èµ·åããåãè² è·ãäžããŠããã®ãµãŒãã¹ãã©ãã ããµãŒãã¹ãæäŸã§ãããã確èªããŸããããšãã°ãåãè«æ±ã®å¶éã1000ãªã¯ãšã¹ãã§ããã1ã€ã®ã€ã³ã¹ã¿ã³ã¹ã200ãåŠçããããšãããã£ãŠããå Žåã5ã€ã®ã€ã³ã¹ã¿ã³ã¹ããããæ£ããåŠçã§ããæ倧å€ã§ããããšãããããŸãã
ãã®ãã¹ãŠã®æ å ±ãInfluxDBã«ä¿åããŸãããææ決å®ãµãŒãã¹ã衚瀺ãããŸãã圌ã¯2ã€ã®å¢çç·ãèŠãŠïŒäžéšãšäžéšãäžéãè¶ ããŠç§»åãããšã圌ã¯ã€ã³ã¹ã¿ã³ã¹ãè¿œå ããå¿ èŠãããããšãç解ããå Žåã«ãã£ãŠã¯ãããã®ã€ã³ã¹ã¿ã³ã¹ã«ãã·ã³ãè¿œå ããããšããããŸããéããŸãçã§ããå€éã«è² è·ãäœäžããå Žåãããã»ã©å€ãã®è»ã¯å¿ èŠãããŸãããäžéšã®ãµãŒãã¹ã®ã€ã³ã¹ã¿ã³ã¹æ°ãæžãããè»ããªãã«ããŠãå°ãã®ãéãç¯çŽã§ããŸãã
äžè¬çãªã¹ããŒã ã¯æ¬¡ã®ããã«ãªããŸãã

åãµãŒãã¹ã¯ãã¡ããªãã¯ãä»ããŠãçŸåšã®è² è·ãå®æçã«å€æããŸãã圌女ã¯åãInfluxDBã«è¡ããŸãããã·ãžã§ã³ãµãŒãã¹ã¯ããã®ç¹å®ã®ã€ã³ã¹ã¿ã³ã¹ã®ãã®ç¹å®ã®ããŒãžã§ã³ã®ãããå€ã«éããŠããããšã確èªãããšãNomadãŸãã¯Kubernetesã³ãã³ããæ¢ã«äžããŠæ°ããã€ã³ã¹ã¿ã³ã¹ãè¿œå ããŸãããããã圌ã¯ãããã¯ã©ãŠãã§æ°ãããµãŒãã¹ãéå§ããåã«ããããã圌ã¯ããã€ãã®ä»ã®æºåäœæ¥ãè¡ããŸããããããäžçªäžã®è¡ã¯ã圌ãæ°ããã€ã³ã¹ã¿ã³ã¹ãäžããå¿ èŠæ§ãéå§ãããšããããšã§ãã
äžéšã®å¶éããããµãŒãã¹ã®å¶éã«ããã«éããããšãæãããªå Žåã¯ã察å¿ããã¢ã©ãŒããçºçããŸããã¯ãããã¥ãŒãªã©ãä¿åãã以å€ã¯äœãã§ããŸããããå°ãªããšãããã«ãã®ãããªåé¡ãçºçããå¯èœæ§ãããããã§ã«æºåãéå§ã§ããããšãç¥ã£ãŠããŸãã
ããã¯ãããã€ãã®äžè¬çãªããšã«ãããã¹ã±ãŒãªã³ã°ã«ã€ããŠã§ãããããŠãããããã¹ãŠã®ãµãŒãã¹ãåãããã»ãªã¯ãæçµçã«ã¯åŽé¢ããäœãä»ã®ãã®ãèŠããšããäºå®ã«ã€ãªãããŸãã-ããã¯Gitlab CIã§ãã

åŸæ¥ã¯ãTeamCityãéããŠãµãŒãã¹ãåéããŠããŸãããããæç¹ã§ããã¹ãŠã®ãµãŒãã¹ã«1ã€ã®ãã³ãã¬ãŒããããããšã«æ°ä»ããŸãããåãµãŒãã¹ã¯äžæã§ããããã圌ã¯èªåèªèº«ãã³ã³ããã«å ¥ããæ¹æ³ãç¥ã£ãŠããŸãããããã®ãããžã§ã¯ããäœæããããšã¯éåžžã«å°é£ã«ãªããŸããããããã®å€ãããããŸãããŸããymlãã¡ã€ã«ã§èšè¿°ãããµãŒãã¹èªäœãšçµã¿åããããšéåžžã«äŸ¿å©ã§ããããšãããããŸããããã®ããããããŸã§å°ããã€ãã®ããšã玹ä»ããŠããŸããããã®èŠéãã¯èå³æ·±ããã®ã§ãã
ãŸããå®éã«ç§ãã¡ããã®å šäœãå§ãããšãã«ç§ãã¡èªèº«ã«èšãããããšã
ãŸãããã€ã¯ããµãŒãã¹ã®éçºã«ã€ããŠè©±ããŠããå Žåãæåã«ã¢ããã€ã¹ããããšã¯ãäœããã®ãªãŒã±ã¹ãã¬ãŒã·ã§ã³ã·ã¹ãã ãããã«éå§ããããšã§ããã³ãã³ãã§å®è¡ããã®ãšåãNomadãšåããããç°¡åã«ããŸããã
nomad agent -dev
ããã«å®å šãªã¿ãŒã³ããŒãªãŒã±ã¹ãã¬ãŒã·ã§ã³ã·ã¹ãã ãæã«å ¥ããããã«Consulãè²ã¡ãNomadèªèº«ãšãã®ãã¹ãŠã®ãããã³ã䜿ããŸãã
ããã«ãããããªããäžçš®ã®ãã©ãã¯ããã¯ã¹ã§äœæ¥ããŠããããšãæããã«ãªããŸããç¹å®ã®ãã·ã³ãç¹å®ã®ãã·ã³ã®ãã¡ã€ã«ã·ã¹ãã ã«çµã³ä»ããããç¶æ ããããã«é¢ããããšããŸãããã®ãããªäœããããã¯ããã«ããªãã®æèãåæ§ç¯ããŸãã
ãããŠããã¡ãããéçºæ®µéã§ã¯ãåãµãŒãã¹ã«å°ãªããšã2ã€ã®ã€ã³ã¹ã¿ã³ã¹ãããããšãå®ããŠããå¿ èŠããããŸãã
次ã®ç¬éã¯ããã¡ãããããã€ãã®å»ºç¯ç©ã§ãããã€ã¯ããµãŒãã¹å ã§ããããã®æãéèŠãªãã®ã®1ã€ã¯ã¡ãã»ãŒãžãã¹ã§ããã
å žåçãªäŸïŒãŠãŒã¶ãŒç»é²ããããŸãããããæãç°¡åãªæ¹æ³ã«ããæ¹æ³ã¯ïŒç»é²ããã«ã¯ãã¢ã«ãŠã³ããäœæãããŠãŒã¶ãŒã«èª²éãäŸé ŒãããŠãŒã¶ãŒãã¢ãã¿ãŒãªã©ã«ããå¿ èŠããããŸããããã«ã¯ãç¹å®ã®æ°ã®ãµãŒãã¹ããããç¹å®ã®ãã®ãããªã¹ãŒããŒãµãŒãã¹ã«å¯ŸããèŠæ±ãããã圌ã¯ãã§ã«ãã¹ãŠã®ç æ£ã§èŠæ±ãåæ£ãå§ããŠããŸãããã®çµæã圌ã¯å®å šã«ç»é²ããããã«ã©ã®ãµãŒãã¹ããã«ããå¿ èŠããããã«ã€ããŠãŸããŸãç¥ã£ãŠããŸãã
å¥ã®æ¹æ³ã§è¡ãæ¹ãã¯ããã«ç°¡åã§ãä¿¡é Œæ§ãé«ããå¹ççã§ããç»é²ãè¡ã1ã€ã®ãµãŒãã¹ãæ®ããŸãã圌ã¯ãŠãŒã¶ãŒãç»é²ããŸããã次ã«ãããŠãŒã¶ãŒãIDãªã©ãæå°éã®æ å ±ãªã©ãç»é²ããŸããããšããã€ãã³ãããã®å ±æãã¹ã«ã¹ããŒããŸãããããŠããã®æ å ±ã圹ç«ã€ãã¹ãŠã®ãµãŒãã¹ãååŸããŸãã 1ã€ã¯è«æ±å ã¢ã«ãŠã³ãã«ç§»åãããã1ã€ã¯ãŠã§ã«ã«ã ã¬ã¿ãŒãéä¿¡ããŸãã
ãã®çµæãã·ã¹ãã ã¯ãã®ãããªç·å¯ãªæ¥ç¶ã倱ããŸããããªãã¯ããã¹ãŠã®äººãšãã¹ãŠã®äººã«ã€ããŠç¥ã£ãŠãããããªã¹ãŒããŒãµãŒãã¹ãæã£ãŠããŸãããããã«ãããå®éã«ãã®ãããªã·ã¹ãã ã§ã®æäœãéåžžã«ç°¡åã«ãªããŸãã
ããŠãç§ããã§ã«èšåããããšããããã®ãµãŒãã¹ã修埩ããå¿ èŠã¯ãããŸãããç¹å®ã®ã€ã³ã¹ã¿ã³ã¹ã«åé¡ãããå Žåã¯ããããããŒã«ã©ã€ãºããŠããã©ãã£ãã¯ãä»ã®ã€ã³ã¹ã¿ã³ã¹ïŒããããçºçããã°ããã®ã€ã³ã¹ã¿ã³ã¹ïŒã«è»¢éããŠã¿ãŠãã ããããããŠãäœãæªãã®ããç解ããŠãã ãããããã«ãããã·ã¹ãã ã®å®è¡å¯èœæ§ãå€§å¹ ã«åäžããŸãã
åœç¶ãã·ã¹ãã ã§äœãèµ·ãã£ãŠããããã©ãã»ã©å¹æçããç解ããã«ã¯ãã¡ããªãã¯ãåéããå¿ èŠããããŸãã
ããã«éèŠãªãã€ã³ãããããŸããäœããã®ã¡ããªãã¯ãç解ããŠããªãå Žåã䜿çšæ¹æ³ãããããªãå ŽåãäœãäŒããŠããªãå Žåã¯ãåéããå¿ èŠã¯ãããŸãããããæç¹ã§ããããã®ã¡ããªãã¯ã¯10åã«ãªãããã§ããå¿ èŠãªãã®ãéžæããããã ãã«å€ãã®ããã»ããµæéãè²»ãããäžèŠãªãã®ãé€å€ããããã«èšå€§ãªæéãè²»ãããŸããããã¯èªéã§ãã
äœããã®ã¡ããªãã¯ãå¿ èŠã§ããããšãç解ããŠããŸããåéãéå§ããŸããäœãã¯å¿ èŠãããŸãã-åéããªãã§ãã ãããããã«ããããã®ããŒã¿ã®åŠçãå€§å¹ ã«ç°¡çŽ åãããŸããããã¯ãããŒã¿ãéåžžã«é«éã«ãªããéåžžã«é«éã«ãªãããã§ãã
äœããã®åé¡ãçºçããå Žåãæ¥ãã§å šå¡ã®ããã«äœããããå¿ èŠã¯ãããŸãããã»ãšãã©ã®å Žåãã·ã¹ãã èªäœãäœããã®åœ¢ã§å¿çããå¿ èŠããããŸããäœããã®ã¢ã¯ã·ã§ã³ãå¿ èŠãªç¶æ³ã§ã®ã¿ã¢ã©ãŒããæ¬åœã«å¿ èŠã§ããæ·±å€ã«äœããå®è¡ããå¿ èŠããªãå Žåãããã¯ã¢ã©ãŒãã§ã¯ãªããèæ ®ããäœããã®çš®é¡ã®èŠåã§ãããæ¡ä»¶ä»ãã®æšæºã¢ãŒãã§åŠçã§ããããšãæå³ããŸãã
ããã ãã§ããããããšã
ãã€ã¯ããµãŒãã¹ïŒå¿ãããããžã§ã¯ãã§ã®çµéš