Playframework ã® Akka è¨å®ãèªã¿è§£ã
â» Play2.0.3 æ代ã®å¤ããã¤ã§ã
Playframework 㯠Akka ãå©ç¨ãã¦ãããæ§è½ã«ç´çµãã¦ãã
ãããCPUãã¡ã¢ãªã«ä½è£ããããæ´ã«å¤§è¦æ¨¡ãªã¢ã¯ã»ã¹ã«å¯¾å¿ãããå ´åã¯ãè¨å®ãä¸æ¸ãã§ããã
application.conf ã§è¨å®å¯è½ã ããPlayã®ããã©ã«ãè¨å®ã¯ä¸è¨ã§ãã
play { akka { event-handlers = ["akka.event.slf4j.Slf4jEventHandler"] loglevel = WARNING actor { deployment { // Akka ã³ã³ããã¼ã©å¦çãå®è¡ããActorè¨å®(ããã©ã«ã24åã®ã¢ã¯ã¿ã¼ãã©ã¦ã³ãããã³ã§ä½¿ãã¾ãã) /actions { router = round-robin nr-of-instances = 24 } // ã¿ã¤ã ã¢ã¦ãã¾ã§ã«å¿çãå®äºã§ããªãå ´åã®ã¹ããªã¼ãã³ã°å¦çã«ä½¿ãActorè¨å® /promises { router = round-robin nr-of-instances = 24 } } // ãã®æé以å ã«Actionãå®äºãã¦ãªãã¨ãã¿ã¤ã ã¢ã¦ãæ±ã retrieveBodyParserTimeout = 1 second // ãµã¼ãããçºçãããªã¯ã¨ã¹ããæãã¦actionã¢ã¯ã¿ã¼ã«å¦çãä¸ããè¨å® actions-dispatcher = { fork-join-executor { parallelism-factor = 1.0 parallelism-max = 24 } } promises-dispatcher = { fork-join-executor { parallelism-factor = 1.0 parallelism-max = 24 } } websockets-dispatcher = { fork-join-executor { parallelism-factor = 1.0 parallelism-max = 24 } } default-dispatcher = { fork-join-executor { parallelism-factor = 1.0 parallelism-max = 24 } } } } }
deployment å ã¯å®éã«å¦çãè¡ãã¤ã³ã¹ã¿ã³ã¹ã¨ãã®ã¹ã¬ããæ°ãåã³ãå¦çãæ¯ãåããæ¹å¼ãæå®ãã¦ããã
akka ã®èª¬æã«ãªãããakka ã®ç»å ´äººç©ã¯ä¸è¨ã®ãã®ããã
- ActorRef : ä¸è¨ã®è¦ç´ ãå
å
ããå¤è¦ãã®Actor
- dispatcher : ã¡ãã»ã¼ã¸ã mailbox ã«æ ¼ç´ããActor ã«å¦çãä¿ã
- mailbox : åãåã£ãå¦çè¦æ±ããmessageãã¨ãã¦æ ¼ç´ãã¦ãããã¥ã¼é å
- Actor : dispatcher ã«å©ãããã¨ãmailbox ãã message ã1件ã¥ã¤å¦çããå¦çã®æ¬ä½
ããããä¸ã¯æ¨æ¸¬ãæ··ãã£ã¦ã¾ããã©ããããæ··ãã£ã¦ããã¯æ³¨éå
¥ãã§ãã
æççãªæ
å ±ããæ¾ããªãã£ãã¨ããã*1
dispatcher è¨å®ã® fork-join-executor 㯠parallelism-max ã§æå®ããã¹ã¬ãããActorã«ä¸ãã¦å®è¡ããæ¹æ³ã使ãçµãã£ããã¹ã¬ããå°¾ãã Actor ãå¼ãã¯ãããå¿
è¦ã«å¿ãã¦ãã¹ã¬ãããå¢æ¸ãããªããå¦çãåãã¾ãã*2
thread-pool-executor ã¨ããã®ããã£ã¦ããã¡ãã¯Actorãã¨ã«å°ç¨ã®ã¹ã¬ãããç¨æãããã¿ã¼ã³ã*3Actor ã¸ã®ã¹ã¬ããå²ãå½ã¦ããªãåãªã¼ãã¼ãããã¯ãªãã§ãããã¹ã¬ããã解æ¾ããããã¨ããªãã®ã§ã¡ã¢ãªãé£ãã¾ãã*4