ïŒã¡ãªã¿ã«ãScalaã¯BankSimpleã«éåžžã«é©ããŠããå¯èœæ§ããããŸããå€ãã®ãµãŒãããŒãã£Javaã³ãŒããçµ±åããå¿ èŠãããããã§ãããããã¯ããã°ã«ãšã£ãŠã¯ãŸã£ããç°ãªããããã¯ã§ãããã»ãšãã©ã®å Žåãå®å šã«ç°ãªãããã°ïŒã
Hacker Newsã§æã話é¡ã«ãªã£ãŠãããã¯ãããžãŒã®1ã€ã¯ã V8ä»®æ³ãã·ã³ã§ã€ãã³ãé§ååJavaScriptã¢ããªã±ãŒã·ã§ã³ãéçºããã³å®è¡ããããã®ç°å¢ã§ããNodeã§ãã ãããžã§ã¯ãã®æè¡éžæã®äžç°ãšããŠãããŒãè©äŸ¡ãå®æœããŸããã æšæ¥ãNodeã«é¢ããäžè¬çãªæçè«ãè¡šæããŸããããã®ç°å¢ã®äœè ã§ããRyan Dahlã¯ãèªåã®èãããã詳现ã«è¡šçŸãã ããã«é Œã¿ãŸããã ããã§ãç§ã¯é²ããŠããŸãã
ãã¡ãããç§ã¯ã»ãšãã©ã®äººããã€ãŠèŠããããšãªãïŒãªãªãžãã«ã§ã¯ã ãã³ããªãã§ïŒäœã¬ãã«Cã«ã€ããŠããå€ããç¥ã£ãŠããè¯ãç·ã§ããåªç§ãªããã°ã©ããŒã§ããã©ã€ã¢ã³ã®ä¿¡çšãå·ã€ãããšããç®æšã¯ãããŸããã ããã§ã¯ãNodeãäžå¿ã«æ¥éã«æé·ããŠããæ奜家ã®ã³ãã¥ããã£ã«ã€ããŠã¯èª¬æããŠããŸããã äžç·ã«ä»äºãããã®ã倧奜ããªããŒã«ãèŠã€ããŠãããã䜿ã£ãŠæé·ãç®æããŠãããªããããã¯ããªãã«ãã£ãšåãäžããŠãããŸãã
ãããããã®èšäºã®ç®çã¯ãNodeãããžã§ã¯ãçšã«èšå®ããã2çªç®ã®ã¿ã¹ã¯ãNodeãã©ã®çšåºŠæºãããã調æ»ããããšã§ããããã¯ãããã€ãã®ã¢ããªã±ãŒã·ã§ã³ã«ãšã£ãŠéèŠã ãšæãããã¿ã¹ã¯ã§ãã
Nodeã¯äœã®ããã«äœæãããŸããïŒ
NodeããŒã ããŒãžã®Aboutã»ã¯ã·ã§ã³ã¯æ¬¡ã®ãšããã§ãã
ãããŒãã®ç®æšã¯ãã¹ã±ãŒã©ãã«ãªãããã¯ãŒã¯ã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããç°¡åãªæ¹æ³ãæäŸããããšã§ããã
以äžã®ããã€ãã®æ®µèœã§èª¬æããŸãã
ãäœããããã¯ãããŠããªããããããã°ã©ãã³ã°ã®å°é家ã§ãã[Node]ã§é«éã·ã¹ãã ãäœæããããšã¯ã§ããŸããã
ããã§ã¯ãã¹ã±ãŒã©ãã«ãªãããã¯ãŒã¯ããã°ã©ã ãäœæããç°¡åãªæ¹æ³ãæäŸããã®ãNodeã®ç®æšãªã®ãããããšãéãšãã¹ããŒãããã°ã©ããŒããé«éã·ã¹ãã ããéçºã§ããããã«ããã®ãã
ãããã®ç®æšã¯é¢é£ããŠããããã«èŠãããããããŸããããå®éã«ã¯éåžžã«ç°ãªã£ãŠããŸãã çç±ãããããç解ããããã«ãç§ã¯ãå°ããªã¹ã±ãŒãªã³ã°ããšãäžè¬çãªã¹ã±ãŒãªã³ã°ããåºå¥ããå¿ èŠããããŸãã
å°ããªã¹ã±ãŒãªã³ã°
å°èŠæš¡ã®ã·ã¹ãã ã§ã¯ãäžè¬ã«ããã¹ãŠãæ©èœããŸãã
ææ°ã®æ©åšã®åã¯ãããšãã°ãå©çšå¯èœãªæãé ãããã°ã©ãã³ã°èšèªã®1ã€ã䜿çšããŠäœå人ãã®ãŠãŒã¶ãŒããµããŒãããWebã¢ããªã±ãŒã·ã§ã³ãäœæã§ããããšã§ãã ã䜿çšç¶æ³ãªã©ã«é¢ä¿ãªã ãªã©...ååãšããŠãå©çšå¯èœãªãã¹ãŠã®ã¢ã³ããã¿ãŒã³ãé©çšãããã®çµæãšããŠå®è¡å¯èœãªã·ã¹ãã ãååŸã§ããŸããããã¯ããœãªã¥ãŒã·ã§ã³ã®éžæè¢ãäžååã§ãã£ãŠãæ©åšãå¹æçã«æ©èœããããã§ãã
ããã¯å®ã«çŽ æŽãããããšã§ãã ããã¯ãç§ãã¡ã奜ããªãã¯ãããžãŒã䜿çšããŠãèããã«ãããã¿ã€ããäœæã§ããããšãæå³ããŸãããããã®ãããã¿ã€ãã¯ãäºæ³ãããããæ©èœããããšããããããŸãã ããã«è¯ãããšã«ã亀éæžæ»ã«å·»ã蟌ãŸããå Žåããããåé¿ããã®ã¯ç°¡åã§ãã åé²ãããšããããšã¯ãæ°åãããŠåé¡ã«ã€ããŠèãã以åã«äœ¿çšãããã®ããããããã«é«ãããã©ãŒãã³ã¹ç¹æ§ãæã€å®è£ ãã¯ãããžãŒãéžæããå¿ èŠãããããšãæå³ããŸãã
ããã§ãNodeã¯å®å šã«é©åãããšæããŸãã
Nodeã䜿çšãã人ãèŠããšã圌ãã¯äž»ã«ã å¶éãããããã©ãŒãã³ã¹ç¹æ§ãšåŒã°ããåçèšèªã§äœæ¥ããWebéçºè ã§ãã Nodeãã¢ãŒããã¯ãã£ã«è¿œå ãããšããããšã¯ããããã®éçºè ã䞊è¡æ§ãæãããæ¯èŒçè¯å¥œãªäžŠè¡æ§ã«ç§»è¡ããããã«å®è¡æã«ã¢ããªã±ãŒã·ã§ã³ã®ããã©ãŒãã³ã¹ãéåžžã«å¶éãããŠãããšããäºå®ã«ç±æ¥ããããšãæå³ããŸãã ãããã®éçºè ã¯ãã¢ããªã±ãŒã·ã§ã³ã®èŠçãªéšåãåé€ããŸãããããã¯ãéåæå®è£ ã«ããé©ããŠããŠãNodeã§æžãçŽããŠå ã«é²ã¿ãŸããã
ããã¯çŽ æŽãããã ãã®ãããªçµæã¯ããé«éã·ã¹ãã ãéçºã§ãããããšãã¹ããŒãããã°ã©ããŒãããå°ãªãããšããNodeã®2çªç®ã®ç®æšã«å®å šã«äžèŽããŸãã ãã ããäžè¬çã«ã¹ã±ãŒãªã³ã°ãšã¯é¢ä¿ããªããããåºãæå³ã§äœ¿çšãããŸãã
äžè¬çãªã¹ã±ãŒãªã³ã°
ããªãã®å²åã®ã·ã¹ãã ã§ã¯ãéæ³ã®åŒŸäžžã¯ãããŸããã
ã·ã¹ãã ãå®è¡ããå¿ èŠã®ããäœæ¥ã®æ»ã«çŽé¢ããŠããå Žåãã©ã®ãã¯ãããžãŒãããããã¹ãŠæ¹åããããšã¯ã§ããŸããã 倧èŠæš¡ã«äœæ¥ãããšãã¯ããã¿ããã®ç«¯ã«æ²¿ã£ãŠç§»åããé©åã«é©çšãããæè¡ãéçºæ¹æ³ãçµ±èšåæãçµç¹å ã³ãã¥ãã±ãŒã·ã§ã³ãã€ã³ããªãžã§ã³ããšã³ãžãã¢ãªã³ã°ç®¡çãæ©åšãšãœãããŠã§ã¢ã®é«éã§ä¿¡é Œæ§ã®é«ãæäœãèŠæç£èŠãªã©ã®å調ãã³ã¹ã圢æããŸãã ã¹ã±ãŒãªã³ã°ã¯å°é£ã§ãã å®éã«ã¯ãæ¡åŒµããèœåã¯ãå€ã«åºãŠè¡ãã ãã§ã¯ããŠã³ããŒããã³ããŒãè³Œå ¥ããŸãã¯çãããšã¯ã§ããªããã®ã®ã競äºäžã®å€§ããªå©ç¹ã§ãã
Nodeã®äž»ãªç®æšã§ãããã¹ã±ãŒã©ãã«ãªãããã¯ãŒã¯ããã°ã©ã ãç°¡åã«äœæããæ¹æ³ãæäŸããããšããç§ã®æ¹å€ã§ãã åºæ¬çã«ãã¹ã±ãŒã©ãã«ãªãã®ãäœæããç°¡åãªæ¹æ³ããããšã¯æããŸããã 人ã ã¯è»œãåé¡ãç°¡åãªè§£æ±ºçãšæ··åããŠããŸãã
éåžžã«å¶éã®å³ããæè¡ã®äžéšãããããã«å¶éã®å°ãªãæè¡ã®ç«¯ã«ã³ãŒãã移åããããšã«ãã£ãŠè§£æ±ºããã®ãç°¡åã§äŸ¿å©ãªåé¡ãããå Žåã幞éãèããŠãã ããããããããã¯ã¹ã±ãŒã«ã§äœæ¥ããããšãæå³ããŸããã Twitterã¯ã Rubyã®èªå·±èšè¿°ã¡ãã»ãŒãžãã¥ãŒãªã©ã®ãµãŒãã¹ã®äžéšãScalaã«ã¢ããããŒãããããšãã«ç°¡åã«åå©ããŸããã ããã¯çŽ æŽãããã£ãããå°èŠæš¡ã«ã¹ã±ãŒãªã³ã°ãããã Twitterã¯ããã¯ãããžãŒãéžæãã以äžã®æå³ããããããå šäœãšããŠã®èŠæš¡ãæ¡å€§ããã®ã¯äŸç¶ãšããŠé£ããæŠãã§ãã
æé·ããŒã
ç§ã«é¢ããŠã¯ãå°ããªã¹ã±ãŒãªã³ã°ããäžè¬çãªã¹ã±ãŒãªã³ã°ãžã®ç§»è¡ã®éçšã§ãéçºè ãšå ±ã«Nodeãæé·ãããã®ã¯é£ãããšæããŸãïŒãããããã³ãŒã«ããã¯ã倧éã®ã¹ãã²ããã£ã³ãŒãã«ãªãããšã¯èšããŸããããéåæã·ã¹ãã ã®éçºè ã«ãšã£ãŠå®éã«èŠçãªç¹ã ããã§ãã
Nodeã¢ãŒããã¯ãã£ã®å€§èãªæ±ºå®ã¯ã ãã¹ãŠã®æäœããã¡ã€ã«I / OãŸã§éåæã§ããããšã§ããããœãããŠã§ã¢ã§ãã®è«æãå®è£ ããéã®äžè²«æ§ãšæå¿«ãã«å¯ŸããRyanã®ã³ãããã¡ã³ããè³è³ããŸãã ã·ã¹ãã ã®ã¯ãŒã¯ããŒããæ·±ãç解ããŠãããšã³ãžãã¢ã¯ãNodeã¢ãã«ãé©åã§ãããç¡æéã«æå¹ã§å¹æçãªå ŽæãèŠã€ããããšãã§ããŸãã Nodeã®é·æçãã€æçããå±éã¯ãŸã èŠãããŠããªããããããã¯ããããŸããã ç§ãåãçµãã§ããã·ã¹ãã ã®ã»ãšãã©ã¯ãåžžã«å€åããŠããŸãã ã¯ãŒã¯ããŒãã¯å€åããŠããŸãã 䜿çšããããŒã¿ã¯ã·ã¹ãã ã§å€æŽãããŸãã 以åã¯éåæãœãªã¥ãŒã·ã§ã³ãšããŠããŸãé©åããŠãããã®ãããã«ãã¹ã¬ãããœãªã¥ãŒã·ã§ã³ã«ãã£ãŠçªç¶ããè¯ãæ©èœããããã«ãªãããŸãã¯ãã®éããããã¯ä»ã®äºæž¬ã§ããªãå®å šãªå€æŽã«åºããããŸããã
Nodeã«æ·±ã没é ããŠããå Žåãåé¡ãšãœãªã¥ãŒã·ã§ã³ãã¢ãã«åãã1ã€ã®æ¹æ³ã§ã䞊åæ§ãå®çŸããæ¹æ³ã®1ã€ã«ãã ãã£ãŠããŸãã ãœãªã¥ãŒã·ã§ã³ãã€ãã³ãã¢ãã«ã®åºç€ã«é©åããªãå ŽåããããããŸãã äžæ¹ãããã€ãã®ç°ãªã䞊ååã¢ãããŒãïŒ JVM ã CLR ãCãC ++ã GHCãªã©ïŒãå®è£ ã§ããã·ã¹ãã ã䜿çšããŠããå Žåãã·ã¹ãã ã®é²åã«å¿ããŠäžŠåæ§ã¢ãã«ãå€æŽããæ©äŒããããŸãã
çŸæç¹ã§ã¯ãNodeã®äž»èŠãªåæ-ã€ãã³ãã¯å¿ ç¶çã«é«ãããã©ãŒãã³ã¹ãæå³ãã-ã¯äŸç¶ãšããŠçåã§ãã ã«ãªãã©ã«ãã¢å€§åŠããŒã¯ã¬ãŒæ ¡ã®ç 究è ã¯ããå®è¡ãããŒã«ã¯ãé«ãåæå®è¡æ§ãäœããªãŒããŒããããããã³åçŽãªåæå®è¡æ§ã¢ãã«ã®ãµããŒããªã©ãã€ãã³ãã¢ãã«ã®åŒ·ã¿ãããããšãçºèŠããŸãã ãã 以åã®ç 究ã«åºã¥ãåŸã®ç 究ã§ã¯ãã€ãã³ããšãã€ãã©ã€ã³ã¢ãã«ã®ã¢ãããŒãã¯åçã«åªããŠããããœã±ããããããã¯ãããšå®éã«ããã©ãŒãã³ã¹ãåäžããããšã瀺ãããŠããŸãã Javaã®ç£æ¥çã§ã¯ã ãã³ããããã³ã°I / Oãå¿ ãããã¹ã¬ããåãããåªããŠãããšã¯éããªãããšãå®æçã«ç€ºåãããŠããŸãã ã¹ãã£ã³ãã©ã¹ãªèŠåºãããªãã¹ããªãŒã ãæªãã¢ã€ãã¢ãªã®ããã§ãã®äž»é¡ã«ã€ããŠæãåŒçšãããããã¥ã¡ã³ãã®1 ã€ã§ãããé«æ§èœãµãŒããŒã®ã¹ããªãŒã ãæŸæ£ãã¹ãã§ã¯ãªããšããçµè«ã§çµãããŸãã 䞊åæ§ã®ç¹ã§ãã¹ãŠã®äººã«çããé©åãããœãªã¥ãŒã·ã§ã³ã¯ãªãããšãææããŸããã
å®éãçŠå¿ããªããã°ã䞊è¡æ§ãžã®ãã€ããªããã¢ãããŒãã®æ¡çšã¯åé²ããŠããããã§ãã ãã³ã·ã«ããã¢å€§åŠã®ã³ã³ãã¥ãŒã¿ãŒç§åŠè ãã¡ã¯ãã¹ããªãŒã ãšã€ãã³ãã®çµã¿åãããäž¡æ¹ã®äžçã®æé«ãæäŸããããšãçºèŠããŸããã Scala EPFLããŒã ã¯ã Actorsãã¹ã¬ããããŒã¹ã®ããã°ã©ãã³ã°ãšã€ãã³ãããŒã¹ã®ããã°ã©ãã³ã°ã1ã€ã®ãã¡ããšããããããããæœè±¡åã«çµã¿åãããŠãããšäž»åŒµããŠããŸãã çŸåšGoogleã®Goããã°ã©ãã³ã°èšèªãããžã§ã¯ãã«æºãã£ãŠããBell Labsã®å åŸæ¥å¡ã§ããRuss Coxã¯ãã¹ã¬ãããšã€ãã³ãã®è°è«ã¯ç¡æå³ã§ãããšäž»åŒµããŠããã«äžæ©åé²ããŸã ïŒããã¯ãã¹ãŠãã·ã¹ãã ã®ã¹ã±ãŒã©ããªãã£ã®åæ£ã«ãã圱é¿ããªãããšã«æ³šæããŠãã ãã;ã¹ã¬ããã¯1å°ã®ã³ã³ãã¥ãŒã¿ãŒçšã®ãã¶ã€ã³ã1ã€ã®ããã»ããµãŒçšã®ã€ãã³ãããã¶ã€ã³;ãã·ã³éã§ã®äœæ¥ã®åæ£ã«ã€ããŠã¯ç°¡åãªæ¹æ³ã§èª¬æããŠããŸãã;ãšããã§ãããã¯Erlangã«å«ãŸããŠãããæ¥æé·ããŠããã·ã¹ãã ãçè·ããŠãããªããããã«ã€ããŠèããå¿ èŠããããŸãïŒã
ã¹ããŒãã¡ã³ãïŒçµéšè±å¯ãªéçºè ã¯ãã¹ã¬ãããšã€ãã³ãã®æ··åç©ã䜿çšããã¢ã¯ã¿ãŒãå®éšçã«ã¯STMãªã©ã®ä»£æ¿ã¢ãããŒãã䜿çšããŸãã 圌ãã«ãšã£ãŠããéããããã³ã°ã¯é«éã§ããããšãæå³ããããšããèãã¯ãå°ãªããšãå°ã銬鹿ããŠããããã«èãããŸãããããã¯ã¹ã±ãŒã©ããªãã£ã®ç¥è©±ãæããŸãã ã¹ã±ãŒã©ãã«ãªãœãªã¥ãŒã·ã§ã³ãæäŸããããã«å€é¡ã®ãéãæã人ã¯ãå€éã«Nodeã䜿çšããŠã·ã¹ãã ãå¿ æ»ã«æžãæããŸããã 圌ãã¯ãã€ããã£ãŠããããšãããŸãã枬å®ããã¹ããæ§èœãã¹ããçèãåé¡ã«é¢é£ããç§åŠæç®ã®ç 究ã§ãã ããã¯äžè¬çã«ã¹ã±ãŒãªã³ã°ããå¿ èŠããããã®ã§ãã
ãããã«
äœæ¥æéã®æè³ã«ã€ããŠã¯ãéåæã¢ãããŒããšä»ã®äžŠååã¢ããªã³ã°ææ³ãæè»ã«çµã¿åãããããšãã§ããã·ã¹ãã ã«åºã¥ããŠããŸãã ãã€ããªããåæå®è¡ã¢ãã«ã¯ãNodeã¢ãããŒãã»ã©åçŽã§ã¯ãªãŒã³ã§ã¯ãããŸããããããæè»ã«ãªããŸãã BankSimpleã¯ãŸã åæ段éã§ãããå°èŠæš¡ã§ã®ã¹ã±ãŒãªã³ã°ãšãã楜ãã課é¡ã«çŽé¢ããŸãããã®åæ段éã§ã¯Nodeãè³¢æãªéžæã«ãªããããããŸããã ããããå šäœãšããŠã¹ã±ãŒãªã³ã°ããå¿ èŠãããå Žåã¯ãããŸããŸãªãªãã·ã§ã³ãçšæãããŠãããç¶æ³ã«å·Šå³ãããã«å€§å¹ ã«æžãæããããå¯èœæ§ã¯ãããŸããã
Nodeã¯ãæ奜家ã®ã³ãã¥ããã£ãä»éããéããããŠæããæªæ¥ãæã€çŽ æŽãããã³ãŒãã§ãã ããã¯ãäž»ã«åçèšèªã®ãŠãŒã¶ãŒããæ¥ãäžä»£ã®Webéçºè ãç¹ã«ã¢ã¯ã»ã¹ã§ããæ¹æ³ã§ãæ©æã¹ã±ãŒãªã³ã°ã®åé¡ã«å¯Ÿããå³æ解決çãæäŸãããçµ±åãã¯ãããžãŒããšããŠãçã«ããªã£ãŠããŸãã Nodeã¯äºæ¬¡çãªç®æšãéæããŠãããšæããããããã¯ãŒã¯æåã®ã¿ã¹ã¯ã解決ããå¿ èŠã®ããçµéšã®æµ ãéçºè ããåãå ¥ããããçç£æ§ãåŒãä»ããŸãã Nodeã¯ç¹å®ã®ã¿ã€ãã®ããã°ã©ããŒã«ãšã£ãŠéåžžã«äŸ¿å©ã§æ¥œãããã®ã§ãããç°¡åã«äœæ¥ãéå§ã§ããããšã¯åŠå®ã§ããŸããã Nodeã³ãã¥ããã£ã®äººã ã¯ãä»ã®æåãªWebã±ãŒãžãããã±ãŒãžãããŒãžã£ãŒããã¹ãã©ã€ãã©ãªãªã©ã«è§Šçºããããã€ãŒã«ãçºæããŠãããããåŸæããŠããŸããã ããã°ã©ããŒã®åã³ãã¥ããã£ã¯ãåæã®ããšãåèããç¬èªã®æšæºã«å°ããŸãã
Nodeã®æ¹ãé©ããŠããçç±ãšããããããå°ãªãçç±ãããã£ãåŸãéèŠãªã¿ã¹ã¯ã«ã¯äžèœè¬ããªãããšãèŠããŠããããšãéèŠã§ãã Nodeãšå³å¯ã«éåæã®ã€ãã³ãã䜿çšããã¢ãããŒãã¯ãäžè¬çãªã¹ã±ãŒãªã³ã°ã䌎ãäžé£ã®ãã¯ãããžãŒãšãã¯ããã¯ã®éåžžã«æ©ã段éã«ãããšèããã¹ãã§ãã
äžè¬çãªãœãªã¥ãŒã·ã§ã³ã«æ³šæããŠãã ããã 誰ããããããªæ°æè¡ã«ã€ããŠè©±ãããšãã§ããŸããããããã®æè¡ã䜿çšãããèŠæš¡ã§å®éã«åããŠãããŸããŸãªçæãééãã人ã¯ã»ãšãã©ããŸããã éåžžãæ°åãç§åŠçç 究ãäžè¶³ããŠãã人ã¯ãé·ãé圹ç«ã£ãŠããããŒã«ãæ¹æ³ãæ±ãã®ã«å¿ããã æéãæ°ãããã¯ãããžãŒã«æè³ããå Žåã¯ãããããåŠã³ãæé·ããæºåãããŠãã ããããããããèªåèªèº«ãå¶éãããŠããããšã«æ°ä»ããããè¹ããé¢ããããšã«ãªããŸãã
ããã¯ç°¡åã§ã¯ãããŸããã