ã©ããã£ãŠå§ãŸã£ãã®
ç§ã¯ãã£ãšWindowsãéçºããŠããŸããã æåã«C ++ã§ã次ã«CïŒã§ã ãã©ãã·ã¥ãããVBãJava Scriptããã®ä»ã®æªéã®éã ããããå°ãåã«ããã¹ãŠãå€ãããæåã«LinuxãJavaãScalaã®äžçã«åºäŒããŸããã ç§ã®å人ã§ããååã§ãããå€ãã®ã¢ã€ãã¢ãæã€Denisã«ã¯ããã§ã«ç§ãã¡èªèº«ã®ãããžã§ã¯ãããããŸãããWindowsçšã®ãŠãŒãã£ãªãã£ã»ããã¯ãçãç¯å²ã§å€§ããªéèŠããããŸããã ããæç¹ã§ãç§ãã¡ã¯ãã®ãããžã§ã¯ããžã®é¢å¿ã倱ããçåãçããŸãã-次ã«äœããã¹ããã ããã¹ã¯ãç°ãªããããžã§ã¯ãéã§ã¯ãªããããŒãã亀æãããµãŒãã¹ãšããæ°ãããããžã§ã¯ãã®ã¢ã€ãã¢ãéå§ããŸããã ãã®ãããžã§ã¯ãã¯ããã¯ãããžãŒã«å ããŠã察象è ã«ãå ããŠã以åã®ãããžã§ã¯ããšã¯å€§ããç°ãªããŸããã ãã®ãµãŒãã¹ã¯ããã¹ãŠã®äººã«åœ¹ç«ã€ã¯ãã§ããã ããŒã¿ãã¯ãªããããŒãã«ã³ããŒããä»ã®ããã€ã¹ã«è²Œãä»ããŸãã çŸåšãããŸããŸãªããã€ã¹ãããã€ãããããããŠãããå€æ°ã®ãŠãŒã¶ãŒã«ã©ã®ããã«æ©èœããããèãããŸã§ãã©ãã§ãç°¡åã«èãããŸãã
æåã®ãããã¿ã€ãã¯æ°ãæåŸã«ç»å ŽããŸããã ãµãŒããŒã¯ASP.NETã§èšè¿°ãããMS IISã§ãã¹ããããŠããŸããã 2ã€ã®ã¯ã©ã€ã¢ã³ããäœæãããŸãããWindowsçšã®C ++ããã³Androidçšã®Javaã§ãã
ãã¹ãã®çµæããããã¿ã€ãã«ã¯çŽ500åã®ååç©ãå«ãŸããŠããããšãããããŸããã ãããããããããããã£ãšãããšããããæ°åäžäººã®ãŠãŒã¶ãŒãé Œãã«ããŠããŸãïŒããŒããŠã§ã¢ããœãããŠã§ã¢ã®ã¢ããã°ã¬ãŒãäžã«ãªãã«ããå¿ èŠããªããç°¡åã«æ¡åŒµã§ããïŒã€ãŸãæ¡åŒµããïŒå€æ°ã®æ¥ç¶ã§åäœã§ãããµãŒããŒãæžãæ¹æ³ãŠãŒã¶ãŒæ°ãå¢å ããå ŽåïŒã
åæ£ã¹ã±ãŒã©ãã«ã·ã¹ãã
ç§ã«ãšã£ãŠããåæ£ã¹ã±ãŒã©ãã«ã·ã¹ãã ãïŒ è¯ãèšäº ïŒã®ãããªè€éãªçšèªã¯ãæè¡ãšè£œåã®èŠ³ç¹ãããã®èåŸã«ãããã®ãç解ãããŸã§ãé垞空ã®ãŸãŸã§ãã ãã®ãããªã·ã¹ãã ã®ç¹æ§ãç¥ãã ãã§ã¯ååã§ã¯ãããŸããããã®ãããªã·ã¹ãã ãèªåã§äœæããŠããã®å©ç¹ãšæ¬ ç¹ããã¹ãŠå®çŸããããšèããŠããŸãã
ãããã£ãŠãã¹ã±ãŒã©ãã«ãªã·ã¹ãã ã«ã¯è€æ°ã®ããŒãïŒããŒãïŒãå¿ èŠã§ãããã®ãããè² è·ãå¢å ããå Žåã«æ°ããããŒããè¿œå ãã1ã€ã®ããŒãã«é害ãçºçããŠãæ®ãã¯æ©èœãç¶ããŸãã ããŒãã¯ãéãŸãã¯ä»®æ³ãã·ã³ã§ãã ãã®å³ããã³ãã®ä»ã®å³ã§ã¯ãåããã¯ã¹ã¯ãSOAïŒãµãŒãã¹æåã¢ãŒããã¯ãã£ïŒã®æé«ã®äŒçµ±ã«åŸã£ãŠããµãŒãã¹ã§ãã å°æ¥ããããã®ãµãŒãã¹ãã©ãã«ã©ã®ããã«é 眮ãããã«ã€ããŠè©±ããŸãã
çŸä»£ã®äŒæ¥ããµãŒããŒã«æžã蟌ããã®ã ããšãã°ãTwitterã¯Scalaã®é¢æ°åèšèªã䜿çšããç¬èªã®ã©ã€ãã©ãªFinagleïŒ Twitterã¹ã¿ã㯠ïŒãæã£ãŠããŸã ã Scalaã§ã¯ã éããããã³ã° ïŒ éããããã³ã° ïŒãäžå€ïŒ äžå€ ïŒã³ãŒããèšè¿°ã§ããŸãã ã¹ã¬ããã¯ãããšãã°IOïŒå ¥åºåïŒæäœäžã«ãªãœãŒã¹ã®è§£æŸãåŸ æ©ããªãããããµãŒããŒãªãœãŒã¹ãç¯çŽããããã«æåã®æ¹æ³ãéèŠã§ãã 2çªç®ã®æ¹æ³ã§ã¯ããã€ã§ãã³ãŒãã䞊ååããè¿œå ã®åæäœæ¥ãªãã§ç°ãªãã¹ã¬ããã§èšç®ãå®è¡ã§ããŸãã ç§ãã¡ã¯ãScalaå°çšã®æ°ãããµãŒããŒã®äœæãéå§ããæåã«Finagleã䜿çšããŸããããåŸã«Playãã¬ãŒã ã¯ãŒã¯ã«ç§»è¡ããŸããã 2çªç®ã®å©ç¹ã¯ãããåçã«éçºãããå€ãã®ãã©ã°ã€ã³ãåžžã«è¡šç€ºãããããšã§ãã
ã客æ§ããµãŒããŒã«æ°ããã¯ãªããããŒããè¿œå ããããšã«é¢ããæ å ±ãè¿ éã«åãåãããã«ããã³ã°ããŒã«ãã¯ãããžãŒã䜿çšããŸããã ã¯ã©ã€ã¢ã³ãã¯ãµãŒãã¹ã«ã¢ã¯ã»ã¹ãããµãŒãã¹ã«æ°ããããŒã¿ããªãå Žåãããã«ã¯ã¯ã©ã€ã¢ã³ãã«å¿çããŸããããæå®ãããã¿ã€ã ã¢ãŠãïŒããšãã°60ç§ïŒã®éæ¥ç¶ãç¶æããŸãã ãã®ã¿ã€ã ã¢ãŠãäžã«ãµãŒããŒãæ°ããããŒã¿ãåä¿¡ããå Žåãä¿æãããæ¥ç¶ã«å¯ŸããŠããã«ããããè¿ããŸãã ãããã£ãŠãã¯ã©ã€ã¢ã³ãã¯åžžã«ãªã¯ãšã¹ããç¹°ãè¿ããæŽæ°ãããããŒã¿ãåŸ ã¡ãŸãã
ãã®ã¡ã«ããºã ã«ããããµãŒãã¹MyService1ãMyService2ãªã©ã¯ãæ°ãããããã¡ãŒã«ã€ããŠçžäºã«éç¥ã§ããå¿ èŠããããŸãã ããšãã°ãã¯ã©ã€ã¢ã³ãããã³ã°ããŠMyService1ããã®çµæãåŸ ã£ãŠããããMyService2ã®å¥ã®ã¯ã©ã€ã¢ã³ãã«ãã£ãŠãããã¡ãŒãè¿œå ãããå ŽåãMyService1ã¯ããã«ãããèŠã€ããŸãã ãµãŒãã¹ããã®ãããªå€æŽã«ã€ããŠäºãã«éç¥ã§ããããã«ããããã«ãAkkaã©ã€ãã©ãªã®ãªã¢ãŒãã¢ã¯ã¿ãŒã䜿çšããŸããã Akkaã¯ããªããžã§ã¯ããžã®ã¢ã¯ã»ã¹ãåæããã«ãªããžã§ã¯ãã䜿çšã§ããã©ã€ãã©ãªã§ãã ããã¯ãåã¢ã¯ã¿ãŒã«ã¡ãã»ãŒãžãéä¿¡ãããçŽæ¥ã®åŒã³åºãã¯è¡ããããç¹å®ã®æç¹ã§1ã€ã®ã¡ãã»ãŒãžã®ã¿ãã¢ã¯ã¿ãŒã«ãã£ãŠåŠçããããšããäºå®ã«ãã£ãŠå®çŸãããŸãã ããã«ãAkkaã§ã¯ãããŒã«ã«ã¢ã¯ã¿ãŒãšåãæ¹æ³ã§ãå¥ã®ãµãŒãã¹ããã¢ã¯ã¿ãŒãåŒã³åºãããšãã§ããŸãã ãªã¢ãŒãã¢ã¯ã¿ãŒã¡ã«ããºã ã¯ã€ã³ã¿ãŒã¯ãŒãã³ã°ãé ããéçºãå€§å¹ ã«ä¿é²ããŸãã ãããã£ãŠãAkka MyService1ïŒããã³ä»ã®ãµãŒãã¹ïŒã䜿çšãããšãæ°ããããŒã¿ãåä¿¡ããå Žåã«ä»ã®ãã¹ãŠã®ãµãŒãã¹ã«éç¥ã§ããŸãã
MyService1ã¯MyService2ããã³MyService3ã®IPã¢ãã¬ã¹ãã©ãã§ååŸããŸããã ZooKeeperã䜿çšããŠã·ã¹ãã æ§æãä¿åããŸããã ãããã£ãŠãåãµãŒãã¹ã¯ãZooKeeperã®IPã¢ãã¬ã¹ãç¥ã£ãŠããããã®ã¢ãã¬ã¹ã«ç»é²ã§ããŸãããŸããã·ã¹ãã å ã®ä»ã®ããŒãã«é¢ããæ å ±ãååŸã§ããŸãã
å³ãããããããã«ãå®è¡æã«ããŒããçŽæ¥è¿œå ãŸãã¯åé€ã§ããã¹ã±ãŒã©ãã«ãªã·ã¹ãã ãäœæããŸããããããŒã¿ããŒã¹ã¯1ã€ã§ãããã·ã¹ãã ã®åŒ±ç¹ã®ãŸãŸã§ãã ããŒã¿ããŒã¹ãžã®ååŒã³åºãã¯ãããªãé·ãæäœã§ãã ããŒã¹ã®è² è·ãæžãããã·ã¹ãã å šäœã®ããã©ãŒãã³ã¹ãåäžãããããã«ããã£ãã·ã¥ãè¿œå ããããšã«ããŸããã ãã£ãã·ã¥ãšããŠRedisã䜿çšããããšã決å®ãããŸããã Redisã¯ãNoSQLããŒå€ããŒã¿ã¹ãã¢ã®ã¡ã¢ãªå ããŒã¿ã¹ãã¬ãŒãžã§ãã ããŸãæ確ã«èãããªããšããäºå®ã«ããããããããã®ã¢ã€ãã¢ã¯éåžžã«åçŽã§ãã Redisã§ã¯ãããŒã§å€ãååŸããããããã¹ãŠã¡ã¢ãªã«ä¿åã§ããŸãã ãããã£ãŠãRedisãžã®åŒã³åºãã¯éåžžã«é«éã§ãã Redisã䜿çšããããã«ããµãŒãã¹ãããã«å¿ããŠå€æŽãããæ°ããããŒã¿ãæåã«Redisã«é©çšããããã®åŸããŒã¿ãèŠã€ãããªãå Žåã«ã®ã¿ããŒã¿ããŒã¹ã«é©çšããå§ããŸããã åæ§ã«ãæ°ãããããã¡ãå°çãããšãããã«ããŒã¹ãšãã£ãã·ã¥ã«èœã¡ãŸããã
åè·¯å ã®æ£æ¹åœ¢ã®æ°ã¯åžžã«å¢å ããŠããŸãããã·ã¹ãã ã®ä¿¡é Œæ§ãåäžããŠããŸãã MyService2ãåé€ãããšããªã¯ãšã¹ãã¯åŒãç¶ãMyService1ããã³MyService3ã«ãã£ãŠåŠçãããŸãã Redisãåé€ãããšããµãŒãã¹ã¯ããŒã¿ããŒã¹ããçŽæ¥ããŒã¿ãåãåããŸãã åé€...ããããDBãšZooKeeperã¯ãŸã åé€ããå¿ èŠã¯ãããŸãããã·ã¹ãã å šäœãããŠã³ããå¯èœæ§ããããŸã:)
ããŒã¿ããŒã¹ã®ä¿¡é Œæ§ã確ä¿ããã«ã¯ãã¬ããªã±ãŒã·ã§ã³ããµããŒãããå¿ èŠããããŸãã ãµãŒãã¹ã«JSONã€ã³ã¿ãŒãã§ãŒã¹ããããMongoDBã§ãµããŒããããŠããJSON圢åŒã§çµæãä¿åããæ¹ã䟿å©ãªãããNoSQL MongoDBããŒã¿ããŒã¹ãéžæããŸããã ããã«ãMongoDBã¯ã¬ããªã±ãŒã·ã§ã³ãå®å šã«ãµããŒãããŸããMongoDBã§è€æ°ã®ããŒããèµ·åãããããã1ã€ã®ã¬ããªã«ã«ãªã³ã¯ã§ããŸãããŸããããŒãã«é害ãçºçããå Žåããã¹ãŠã®ã¯ã©ã€ã¢ã³ããä»ã®ããŒããšé£æºã§ããŸãã MongoDBã®ã¬ããªã«ã¯ãå°ãªããšã3ã€ã®ããŒãã§æ§æããå¿ èŠããããŸãïŒãã©ã€ããªããŒããã»ã«ã³ããªããŒããããã³ä»ã®ããŒããç£èŠããã¢ãŒãã¿ãŒãã¡ã€ã³ããŒãã«é害ãçºçããå Žåãã»ã«ã³ããªããŒããã¡ã€ã³ããŒãã«ããŸãã
ããã§ãMongoDBã䜿çšããŠããŒãã®1ã€ãå®å šã«ãªãã«ã§ããã·ã¹ãã ã¯ãããèªèããŸããã ZooKeeperã«ã€ããŠã¯è©³ãã説æããŸããããã·ã¹ãã ã®Achaelesã®ãããšã§ã¯ãªããMongoDBãã¬ããªã±ãŒã·ã§ã³ããµããŒãããŸãã
现å¿ã®æ³šæãæã£ãèªè ã¯ãããŒãMyService1ãMyService2ãããã³MyService3ã®éã§èŠæ±ãã©ã®ããã«åæ£ãããããšãã質åããã€ãã¹ããããšã«æ°ä»ãã§ãããã æ·±å»ãªã·ã¹ãã ã§ã¯ããã®ããã«ããŒããã©ã³ãµãŒã䜿çšãããŸãã ãã ããã·ã¹ãã ã®ç¡éã®æ°ã®è£å©ãµãŒãã¹ã«ãã§ã«é£œããŠããå Žåã¯ãDNSãåçŽãªããŒããã©ã³ãµãŒãšããŠäœ¿çšã§ããŸãã DNSã®api.myservice.comãµãŒãã¹ã«ãªã¯ãšã¹ããå±ããšãããã€ãã®IPã¢ãã¬ã¹ãè¿ãããŸãã ããªãã¯ã¯ããªã¯ãšã¹ãããšã«ãããã®IPã¢ãã¬ã¹ã®é åºãå€ããããšã§ãã ããšãã°ãæåã®ãªã¯ãšã¹ãã®å Žåãapi.myservice.comã¯æ¬¡ã®å€ãè¿ããŸããã132.111.21.2ã132.111.21.3ã132.111.21.4ã2çªç®ã®132.111.21.3ã132.111.21.4ã132.111.21.2ã®å Žåãã¯ã©ã€ã¢ã³ãã¯åžžã«ãªã¹ãã®æåã®IPã«ã®ã¿ã¢ã¯ã»ã¹ããããšããŸãããšã©ãŒã®å Žåã2çªç®ãŸãã¯3çªç®ã䜿çšããŸãã
å±é
ãã®çµæãçã«ã¹ã±ãŒã©ãã«ãªïŒãµãŒãã¹ããŒãã®è¿œå ãšåé€ãå¯èœïŒãåæ£ïŒãµãŒãã¹ã¯ç°ãªãããŒããããã«ã¯ç°ãªãããŒã¿ã»ã³ã¿ãŒã«ãé 眮å¯èœïŒã·ã¹ãã ãæ§ç¯ããŸããã
ã¢ããªã±ãŒã·ã§ã³ããã®ãããªã·ã¹ãã ã®åºæ¬çãªèŠä»¶ãæºãããŠãããã©ããã確èªããŸãããã
- å¯çšæ§-ã·ã¹ãã ã¯åžžã«å©çšå¯èœã§ãã ããŒãã®ããŒããŠã§ã¢ãå€æŽããŠããä»ã®ããŒãã¯åŒãç¶ãæ©èœããŸãã ãœãããŠã§ã¢ãæŽæ°ããããšãã§ããŸã
- ããã©ãŒãã³ã¹-ããé«åºŠãªããŒããã©ã³ãµãŒã䜿çšãããšããšãŒãããã®ãŠãŒã¶ãŒããšãŒãããã®ããŒãã«ãã¢ã¡ãªã«ã®ãŠãŒã¶ãŒãã¢ã¡ãªã«ã®ããŒãã«è² æ ããããããšãã§ããŸãã ããã«ãRedisã䜿çšãããšãããŒã¿ããŒã¹ã¢ã¯ã»ã¹ãå€§å¹ ã«åæžãããŸãã
- ä¿¡é Œæ§-ããŒãã«é害ãçºçããå Žåãä»ã®ããŒãã¯åŒãç¶ãåäœããŸã
- ã¹ã±ãŒã©ããªãã£-奜ããªã ãMyServiceNãè¿œå ã§ããŸã
- 管çæ§-ããŒãããŸã 質åããããŸãããïŒ
- ã³ã¹ã-ãã®ãããžã§ã¯ãã§äœ¿çšããããã¹ãŠã®ãã¯ãããžãŒãšã©ã€ãã©ãªã¯ç¡æãŸãã¯ãªãŒãã³ãœãŒã¹ã§ã
ãããã£ãŠãçåã®æ®ãåºæºã¯1ã€ã ãã§ãããããã¯å¶åŸ¡æ§ã§ãã å€æ°ã®ãµãŒãã¹ã§æ§æãããSOAã·ã¹ãã ãå±éããæãç°¡åãªæ¹æ³ã¯äœã§ããïŒ ç§ãã¡ã¯ãããªãæ°ãã確ç«ããããã¯ãããžãŒã§ããDockerã䜿çšããããšã«ããŸããã Dockerã¯ãåºã䜿çšãããŠããä»®æ³ãã·ã³ã«å€å°äŒŒãŠããŸãããããã€ãã®å©ç¹ããããŸãã Dockerã䜿çšãããšããµãŒãã¹ããšã«dockerã³ã³ãããŒãäœæãããããããã¹ãŠ1å°ãŸãã¯ç°ãªããã·ã³ã§å®è¡ã§ããŸãã éèŠãªç¹ã¯ãDockerã¯Linuxã«çµã¿èŸŒãŸããä»®æ³åã¡ã«ããºã ã䜿çšãããããä»®æ³ãã·ã³ãšã¯ç°ãªããè¿œå ã®ãªãœãŒã¹ãå¿ èŠãšããªãããšã§ãã ããã§ãã·ã¹ãã ã®ãã¹ãŠã®ããŒãçšã®ã³ã³ãããäœæããŸããã ããã«ããããã¹ãŠã®ã³ã³ããã1ã€ã®ããŒãã§å®è¡ãããŠãããã¹ãç°å¢ãšãåã³ã³ãããç¬èªã®ããŒãã«ããäœæ¥ç°å¢ãåæ§ã«ç°¡åã«å±éã§ããŸãã
ããæç¹ã§ãã·ã¹ãã ãã©ãã«é 眮ããããšããåé¡ã«çŽé¢ããŸããã æã人æ°ã®ããã¯ã©ãŠããããã€ããŒã§ããAmazonãæ€èšããŸãããããéãç¯çŽããããå®äŸ¡ãªããžã¿ã«ãªãŒã·ã£ã³ã«ã¢ããªã±ãŒã·ã§ã³ãé 眮ããããšã«ããŸããã