Akkaã§å§ãã並è¡å¦ç(1) - ã¢ã¯ã¿ã¼ã¢ãã«ã¨Akkaã®æ¦è¦
æ¦è¦
è¿å¹´ãã³ã³ãã¥ã¼ã¿ã® CPU ã¯ãã«ãã³ã¢ãå½ããåã«ãªã£ãããã«ãã³ã¢ã使ãã«ã¯ãã«ãã¹ã¬ããããã°ã©ã ãæ±ãå¿ è¦ãããã
ã¾ããã¢ããªã±ã¼ã·ã§ã³ã§ã¯ Web ãµã¼ãã¹ãªã©è¤æ°ã®ãããã¯ã¼ã¯éä¿¡ã使ç¨ãããã¨ãå¤ããªã£ã¦ãããé常ãããã¯ã¼ã¯éä¿¡ã¯åæå¦çã§è¡ããããè¤æ°ã®ãããã¯ã¼ã¯éä¿¡ãåæå¦çã§è¡ãã¨ãéä¿¡çµæã®å¾ ã¡æéãå¢ããããå¦çæéã延ã³ã¦ãã¾ããå¦çæéãç縮ããããã«ã¯ãéä¿¡ã®éåæåã並ååãå¿ è¦ã¨ãªãã
ãã«ãã³ã¢ã使ãããªãããã¤è¤éãªã¢ããªã±ã¼ã·ã§ã³ãæ§ç¯ããããã«ã¯ã並è¡å¦çãç°¡åãã¤å¹ççã«è¨è¿°ããå¿ è¦ãããã
ãã®é£è¼ã§ã¯ãã¢ã¯ã¿ã¼ã¢ãã«ã«ãã並è¡å¦çã©ã¤ãã©ãª Akka ãéãã¦ã並è¡å¦çãå®ç¾ããæ¹æ³ãç´¹ä»ããã
ä»åã¯ã¢ã¯ã¿ã¼ã¢ãã«ã¨ Akka ã®æ¦è¦ã«ã¤ãã¦è¿°ã¹ãã
ã¢ã¯ã¿ã¼ã¢ãã«ã¨ã¯
並åå¦çãå¹ççã«å®ç¾ããæ¹æ³ã®ã²ã¨ã¤ã«ã¢ã¯ã¿ã¼ã¢ãã«ãããã
ã¢ã¯ã¿ã¼ã¢ãã«ã¨ã¯ã1973å¹´ã«ã«ã¼ã«ã»ãã¥ã¼ã¤ããæ°ãçºè¡¨ãã並è¡å¦çãè¡ãããã®è¨ç®ã¢ãã«ã§ããã ãã«ãã³ã¢ã®ã³ã³ãã¥ã¼ã¿ãé«éãããã¯ã¼ã¯ã§æ¥ç¶ããæ代ãæ³å®ãã¦èæ¡ããããã®ã®ãããç¾å¨ã«åè´ãã¦ããã
ã¢ã¯ã¿ã¼ã¢ãã«ã§ã¯ãã¢ã¯ã¿ã¼ã¨å¼ã°ãããªãã¸ã§ã¯ãå士ã並åã§ã¡ãã»ã¼ã¸ãéåä¿¡ããã£ã¦å¦çãå®ç¾ããã ã¢ã¯ã¿ã¼ã¯ããªãã¸ã§ã¯ãæåããã°ã©ã ã«ããããªãã¸ã§ã¯ãã®ããã«ãã¢ã¯ã¿ã¼ã¢ãã«ã®ä¸»å½¹ã¨ãªããã®ã ã
1ã¤1ã¤ã®ã¢ã¯ã¿ã¼ã¯ãã¡ãã»ã¼ã¸ãåä¿¡ããããã®å°ç¨ã®ã¡ã¼ã«ããã¯ã¹ãæã£ã¦ããã
ã¡ã¼ã«ããã¯ã¹ã«ã¡ãã»ã¼ã¸ãåä¿¡ããã¨ãã¡ãã»ã¼ã¸ã®å
容ã«å¿ããå¦çãè¡ããã¨ãã§ããã
ãã®å¦çã®ä¸ã§ã¯ãä»ã®ã¢ã¯ã¿ã¼ã«åãã¦ã¡ãã»ã¼ã¸ãéä¿¡ãããã¨ãã§ããã
ã¤ã¡ã¼ã¸ã以ä¸ã«ç¤ºãã
ã¢ã¯ã¿ã¼ã¢ãã«ã®ç¹å¾´ã¯ãä¸è¨ã®æ©è½ãå ¨ã¦éåæã§å¦çãããã¨ã«ããã ã¢ã¯ã¿ã¼å士ã¯ã¡ãã»ã¼ã¸ãéãã¦ã®ã¿çµåãããããççµåã§ããç¬ç«æ§ãé«ããªãã ã¾ããã¢ã¯ã¿ã¼ãæã¤ç¶æ ã¯èªåããããåç §ã§ããªããããããã¯ãããå¿ è¦ããªãã
ãã®ãããã¢ã¯ã¿ã¼ã¢ãã«ã«ãã並è¡å¦çãå©ç¨ããã¨ãæä»å¶å¾¡ãããã°ã©ããæèããå¿ è¦ãç¡ããªãã
Akka ã®æ¦è¦
Akka ã¯ã JVM ã®ãã«ãã¹ã¬ããä¸ã§ã¢ã¯ã¿ã¼ã¢ãã«ãå®ç¾ãããOSS ã®ä¸¦è¡å¦çã©ã¤ãã©ãªã§ãããéçºè¨èªã¨ãã¦ãJava 㨠Scala åãã®2ã¤ã使ç¨ã§ããã
2011å¹´ã«ãã¼ã¸ã§ã³1.0ãå ¬éãããç¾å¨ã¯ Lightbend 社ï¼æ§ Typesafe 社ï¼ä¸»å°ã§ã¡ã³ããã³ã¹ãè¡ã£ã¦ããã Lightbend 社ã¯ãScala èæ¡è ã® Martin Odersky ãåµå§è ã§ãPlay Framework ãªã© Scala ã Java ã®èåãªã©ã¤ãã©ãªãéçºãã¦ããä¼æ¥ã§ããã
ç¹å¾´ã¨ãã¦ã大ããããã°ã©ã ãå¤ãããã¨ãªãã¹ã±ã¼ã«ã¢ããã»ã¹ã±ã¼ã«ã¢ã¦ãã®ããããå®ç¾ã§ãããã¨ãæããããã
å¾æ¥ã®æ¹æ³ã§ã¯ãã¹ã±ã¼ã«ã¢ãããããå ´åã¯ããã°ã©ã ããã«ãã¹ã¬ããåããå¿ è¦ããããã¹ã±ã¼ã«ã¢ã¦ããããå ´åã¯ãªã¢ã¼ããã·ã³ã«å¯¾ã㦠RPC ãªã©ã®æ段ã§ãããã¯ã¼ã¯éä¿¡ãè¡ãå¿ è¦ããã£ãã ä¸æ¹ãAkka ã¯ãã«ãã¹ã¬ããã®å¶å¾¡ã¨ãããã¯ã¼ã¯éä¿¡ã®ä¸¡æ¹ãé è½ããè¨å®ã«å¿ãã¦ä¸¡è ãåãæ¿ãããã¨ãã§ããã
Akka ã®ä¸»è¦ãªæ©è½ã¯ä»¥ä¸ã®éãã ã
ã¢ã¯ã¿ã¼ã¢ãã«
ã¢ã¯ã¿ã¼ã¢ãã«ã«ããããã°ã©ã ãè¡ãããã® API ããã¢ã¯ã¿ã¼ãå®è¡ããããã®åºç¤ãæä¾ããèé害æ§
ã¢ã¯ã¿ã¼ãç£è¦ããç°å¸¸çµäºããå ´åã®å¯¾å¦ãæè»ã«è¨å®ã§ãããä½ç½®ééæ§
è¤æ°ã®ãµã¼ãã¼ã JVM ã«ã¾ããã£ã¦ã¢ã¯ã¿ã¼ãé ç½®ã§ããã ã¡ãã»ã¼ã¸ãéä¿¡ããã¢ã¯ã¿ã¼ãåã JVM ã«ããããç°ãªã JVM ã«ããããæèããå¿ è¦ãç¡ããåãããã°ã©ãã³ã°ã§å®ç¾ã§ããã ã¾ããè¤æ°ãµã¼ãã¼ã¸ã®ã¢ã¯ã¿ã¼ã®é ç½®ãè¨å®ãã¡ã¤ã«ã®ä¿®æ£ã®ã¿ã§å¯¾å¿ã§ãããã¯ã©ã¹ã¿ã»åé·å
åä¸ã®ä»äºãããã¢ã¯ã¿ã¼ãã°ã«ã¼ãåããè¤æ°ã® JVM ä¸ã§æ±ããã¨ãã§ããã ããã«ãããå¦çæ§è½ã®åä¸ãå³ããã¨ãã§ãããæ°¸ç¶æ§
ã¢ã¯ã¿ã¼ãã¡ã¢ãªã«æã¤ç¶æ ãããã¼ã¿ãã¼ã¹ãªã©ã«ä¿åãããã¨ãã§ããã ããã«ãããé害ã®å復ãã¢ããªã±ã¼ã·ã§ã³ã®åèµ·åæã«ãç¶æ ã®å¾©å ãã§ãããæ¡å¼µã©ã¤ãã©ãª
åä½ãã¹ããã¼ã«ããã¤ãã³ããã¹ãAkka ããã¼ã¹ã«ãã HTTP ã©ã¤ãã©ãªãããªã¢ã¯ãã£ãã¹ããªã¼ã å®è£ ãªã©ãå¤æ°ã®æ¡å¼µã©ã¤ãã©ãªãæä¾ããã¦ããã
ã¾ã¨ã
ä»åã¯ãã¢ã¯ã¿ã¼ã¢ãã«ã¨ Akka ã®æ¦è¦ãç´¹ä»ããã
次å以éã Akka ãåããæ©è½ã«ã¤ãã¦ããµã³ãã«ã³ã¼ãã示ããªãããä¸ã¤ãã¤ç´¹ä»ãã¦ããã ãµã³ãã«ã³ã¼ãã¯ãã¢ã¯ã¿ã¼ã¢ãã«ã¨ã®ç¸æ§ãè¯ã Scala ãä¸å¿ã«ç´¹ä»ããäºå®ã ã Scala åºæã®ææ³ãæ©è½ã«ã¤ãã¦ã¯ãé½åº¦è§£èª¬ããã®ã§ Scala ã«è©³ãããªãæ¹ãå®å¿ãã¦ã»ããã
次åã¯ãã¢ã¯ã¿ã¼ãç¨ããåºæ¬çãªããã°ã©ã ãç´¹ä»ããã
[åå¤ è³¢å¤ªé]