App Engineã§ã¯ã©ã®è¨èªã使ãã°ããã®ã
App Engineã§ä½¿ããè¨èªã¯åºæ¬çã«ã¯Pythonã¨Javaã§ããããã§ã¯ãã©ã¡ããé¸ã¶ã®ãè¯ãã®ã§ããããã
ãã以å¤ã®è¨èªã®äººåãã®è©±ã¯å¾ããåºã¦ããã®ã§ãã°ãããã®ã¾ã¾ãèªã¿ãã ããã
趣å³ãªãã°åã«å¥½ããªãã®ãé¸ã¶ã ãã§ããã®ã§ãããä»äºã§ä½¿ãããã«ã¯ãé·æã¨çæããã¡ãã¨ææ¡ããä¸ã§é¸ã¶å¿ è¦ãããã¾ããã¾ããããã§ã®è©±ã¯è¨èªã¨ãã¦ã®ä¸è¬çãªè©±ã§ã¯ãªãApp Engineã§ä½¿ãã¨ãéå®ã®è©±ã¨ãã¦ãèªã¿ãã ããã
ã¾ãå®å®åº¦ã§ãããã¤ã³ãã©é¨åã®å®å®åº¦ã¯ãã©ã¡ããåºæ¬çã«åãã§ãããããããã¨ãã¾ã£ããåããã®ã使ã£ã¦ããã®ããããã¾ããã
ãã®ä¸ã§åãAPIã®é¨åã¯ãã¤ã³ãã©ã¨ç´æ¥çµã³ã¤ãã¦ããä½ã¬ãã«ãªé¨åã¨ä½ã¬ãã«ãªAPIã®ä¸ã«æ§ç¯ãããé«ã¬ãã«ãªé¨åã¨ã«åãã¦èããå¿
è¦ãããã¾ãã
ä½ã¬ãã«ãªAPIã¯LLAPIã¨å¼ã°ããããã¾ãããå®å®åº¦ã¯ãPythonã¨Javaãåãã§ããAPIèªèº«ãé常ã«ããä¼¼ã¦ãã¾ããè¨èªã®éãããã¾ãæããããªããããã§ãã
é«ã¬ãã«ãªAPIã¯ãã¼ã¿ãã¼ã¹ã«æ¥ç¶ããé¨åã ã¨JavaãªãJDO/JPAãPythonã ã¨dbã¢ã¸ã¥ã¼ã«ã ã¨ããããã¾ããå®ã¯ããã®é¨åããJavaã¨Pythonã®éå½ããããã¦ãã¾ããPythonã®æ¹ã¯å®å®ãã¦ãã¾ãããJavaã®æ¹ã¯ãã¾ã ã¾ã ãã°ããã£ããä»æ§ãå¤ãã£ãããããã¨ãããã®ã§ãããã ãæåã®é ã«æ¯ã¹ãã¨ããªãæ¹åããã¦ãã¦ãä»ã§ã¯é »ç¹ã«ãã°ã«ééãããã¨ã¯ããã¾ãããå®å¿ãã¦ä½¿ãããã¨ããã¨ããã§ããªããã©ã
Javaã®æ¹ãPythonããå®å®ãã¦ããªããããªã¤ã¡ã¼ã¸ãããã®ã¯ããã®è¾ºã«åå ãããã®ããããã¾ããã
Javaã使ãããããªããå¿é ãããã¨ã¯ããã¾ãããSlim3ã使ãã°ããã®ã§ããSlim3ã¯ãå®å®ãã¦ããLLAPIã®ä¸ã«æ§ç¯ããã¦ããèãã©ããã¼ãªã®ã§ããã¾ããã°ãå ¥ãè¾¼ãééãããã¾ããã1.0.0ããªãªã¼ã¹ãããããå®å¿ãã¦ä½¿ããã¨ãã§ãã¾ããJavaã§éçºããå ´åãSlim3ã使ãã°å®å®ããéçºãå¯è½ãªã®ã§ãã
次ã¯ããã©ã¼ãã³ã¹ã«ã¤ãã¦ã§ããããã©ã¼ãã³ã¹ã¯spin-up(ã¢ããªã±ã¼ã·ã§ã³ã®èµ·å)ã¨ãªã¯ã¨ã¹ãã®å¦çã®äºã¤ã«åãã¦ã¿ã¦ããã¾ãã
spin-upã®é度ã¯AppEngineã«ããã¦ãé常ã«éè¦ãªãã®ã§ãã
ããã¾ã§ã®ã¹ã¿ã¤ã«ã§ã¯ãã¢ããªã±ã¼ã·ã§ã³ã®èµ·åæã«åºæ¥ãéãã®æé©åãè¡ã£ã¦ããããªã¯ã¨ã¹ãã®å¦çãçããããã¨ãéè¦ã§ãããã¢ããªã±ã¼ã·ã§ã³ã®èµ·åã¯ã©ããä¸åãããããªãã®ã ããããã®é度ã¯ãã¾ãéè¦ã§ã¯ãªãã£ãã®ã§ãã
ããããAppEngineã§ã¯ã2,3åã¢ã¯ã»ã¹ããªãã¨ç´ãã«ã¤ã³ã¹ã¿ã³ã¹ãspin-down(çµäº)ããã次ã«ãªã¯ã¨ã¹ãããã£ãã¨ãã«ãspin-upãèµ·ããã®ã§ãspin-upã¯ã¨ã¦ãé »ç¹ã«ããã¾ããã¾ãããªã¯ã¨ã¹ããéä¸ãã¦scale outãå¿
è¦ãªã¨ãã«ãspin-upãããã¾ãã
spin-upã®é度ã¯AppEngineã«ããã¦ãé常ã«éè¦ãªãã®ãªã®ã§ãã大äºãªãã¨ãªã®ã§ãªãã©ãããã¾ããã
ã¨ã¦ãåç´ãªã¢ããªã±ã¼ã·ã§ã³ã§æ¯è¼ããã¨Pythonã®spin-upã¯100ms以ä¸ãJavaã¯1000ms以ä¸ã大éæã«ãã£ã¦Pythonã®æ¹ã10åéãã¨è¨ããã§ãããã
ããã¯ãåç´ãªã¢ããªã±ã¼ã·ã§ã³ã§ã®å ´åã§ãããSpringã®ãããªééç´ã®ãã¬ã¼ã ã¯ã¼ã¯ã使ãã¨spin-upã20000msãè¶
ãããã¨ãããã§ããæ¡ãééã£ã¦æ¸ãã¦ããããã§ã¯ããã¾ããã念ã®ãããDIContainerã®ä¸ã§ã¯è»½ãã¨ãããã¦ããGuiceã§ã7000msãã8000msãããããã£ããããã®ã§AppEngineã§DIContainerã使ãã®ã¯ãã¾ãç¾å®çã§ã¯ããã¾ããã
ãã¨ãã¨DIContainerãæ®åããã®ã¯ããã¹ããããããããããã¨AOPã使ã£ã宣è¨çãã©ã³ã¶ã¯ã·ã§ã³ãªã©ã使ããããã§ãããAppEngineã§ã¯ãã¹ããããããã®ãã¬ã¼ã ã¯ã¼ã¯ãæ´åããã¦ãã¦DIContainerãªãã§ããã¹ããç°¡åã«è¡ãã¾ãããAppEngineã§ã¯åºæ¬çã«GlobalTransactionã使ããããéå®ãããç¯å²ã§ãããã©ã³ã¶ã¯ã·ã§ã³ã使ããªãã®ã§ã宣è¨çãã©ã³ã¶ã¯ã·ã§ã³ãå½¹ã«ç«ã¡ã¾ããã
ã¤ã¾ããAppEngineã§ã¯ãDIContainerã使ãã¡ãªããããã¾ããªãããã¡ãªãããé常ã«å¤§ããã®ã§ãDIContainerã使ãã¹ãã§ã¯ããã¾ããã
ãã£ã¨ããã¨ãæ©è½ã®è±å¯ãªãã¬ã¼ã ã¯ã¼ã¯ã¯ãspin-upãé
ããAppEngineã®å¶éããè±å¯ãªæ©è½ã使ããªãã£ããããã®ã§ãAppEngineã«ã¯åããªãã¨è¨ãã¾ãã
JDO/JPAãspin-upã«4000msãã5000msããããããã®ã§ãã¯ã£ãããã£ã¦AppEngineã«åãã¦ãã¾ãããæ¨æºã§ç¨æããã¦ãããã¬ã¼ã ã¯ã¼ã¯ãAppEngineã«åãã¦ããªãã¨ããã®ã¯ãã¡ãã£ã¨ã©ãããªã¨æãã¾ããã
AppEngineã§ã¨ããããåä½ããã¨ãããã¨ã¨ãå®ç¨çã«ã¤ãããã¨ãããã¨ã¯ã¾ãã§éãã¾ããèªåãã¡ãããã¾ã§ä½¿ã£ã¦ãããã¬ã¼ã ã¯ã¼ã¯ãAppEngineã§è©¦ãã¦ã¿ã¦ãspin-upã®é
ãã«ãã£ããããã¨ããéçºè
ã¯ãä¸çä¸ã«ãã£ã±ããã¾ã(MLãtwitterã§ããè¦ã)ã
ãã®è¾ºããAppEngine for Javaãé
ãã¨æããã¦ããåå ãªã®ããããã¾ããã
Javaã使ãããããªããå¿é ãããã¨ã¯ããã¾ãããSlim3ã使ãã°ããã®ã§ããSlim3ã¯AppEngineã«æé©åããã¦ããã®ã§spin-upã1100msãããã§ããè¶ åç´ãªServletããè¥å¹²(200msãã400ms)ãªã¼ãã¼ããããããããããªã®ã§ãå®å¿ãã¦ä½¿ããã¨ãã§ãã¾ãã
ãªã¯ã¨ã¹ãã®å¦çã¯ãåç´ãªRequest Handlerã®å ´åãJavaã®æ¹ãPythonãã10åéãã¨ããçµæãããã¾ãããã ãå®éã¯ãBigtableã¸ã®ã¢ã¯ã»ã¹ãªã©ãå«ãã®ã§10åã®å·®ã¯éããªãã§ãããã
ãªã¯ã¨ã¹ãæã«åãããã¼ã¿ã¢ã¯ã»ã¹ã®å¦çãJDO/JPAã¯ãã£ãããã¦ãã¦é
ãã§ããSlim3ã®æ¹ãå§åçã«éãã®ã§ããã²æ¬¡ã®ãã¢ãèªåã§è©¦ãã¦å®æãã¦ãã ããã
http://slim3demo.appspot.com/performance/
ããã¾ã§ã®è©±ãã¾ã¨ããã¨ãAppEngineã§éçºããå ´åãPythonã¨æ¯ã¹ã¦Javaã¯ãå®å®åº¦ã«é£ããããspin-upã®é度ããã¼ã¿ã¢ã¯ã»ã¹ã®é度ã«åé¡ãæ±ãã¦ãã¾ãããããã®åé¡ã解決ããã«ã¯ãSlim3ã使ãã®ãè¯ãã¨ãããã¨ã§ãã
ãã¡ãããJava使ãã§Slim3ã使ããã«éçºãã¦ãã人ãããã¨æãã¾ããããã®äººéã¯ãä¸è¨ã«ãããåé¡ãæ±ãã¦ããã¯ãã§ãã
ãã¦èå¿ãªãã©ã®è¨èªãé¸ãã æ¹ããããã§ãããPythonã®åºæ¥ãããã®ã§ãLLãªäººã¯Pythonã使ãã®ãããããã§ããããã¾ã§PHPãRubyã使ã£ã¦ããæ¹ãä»äºã§ä½¿ããªããPythonã使ã£ãæ¹ãåºãã§ãã
JVM(Java)çµç±ã§Ruby(JRuby)ãPHP(Quercus)ã使ãæãããã¾ãããJavaã®ãªã¼ãã¼ãããã«å ãã¦ããã«ScriptEngineã®ãªã¼ãã¼ããããå ããã®ã§é度çã«ã¯æå¾
ã§ãã¾ããã
ãã ãJRubyã¯é å¼µã£ã¦ãã¥ã¼ãã³ã°ãã¦ãã¦ãææ°çã ã¨Sinatraã§8000msä½ã§spin-upãããããªã®ã§ããªãã¨ã使ããããããã¾ãããSinatraã§ãå³ããããããªã®ã§ãAppEngineã§Railsãä»äºã§ä½¿ãã®ã¯ãä»ã®ã¨ããç¾å®çã§ã¯ãªãã§ãããã
Pythonã使ãä¸ã§ã®æ³¨æç¹ã¯ãDjangoã®ãããªé«æ©è½ãªãã¬ã¼ã ã¯ã¼ã¯ã使ãã¨Pythonã§ãéããªã£ã¦ãã¾ãã¨ãããã¨ã§ããKayã®ãããªAppEnginejã«æé©åããã¦ãããã¬ã¼ã ã¯ã¼ã¯ã使ãã®ãããããã§ãã
http://code.google.com/p/kay-framework/
Java使ãã®æ¹ã¯ãSlim3ã使ãã®ããªã¹ã¹ã¡ããã¡ãããSlim3ã好ã¿ã«åããªã人ã沢山ããã¨æãã¾ããã使ããªãå ´åã¯ãä¸è¨ã§ä¸ãããããªåé¡ãèªåã§è§£æ±ºããå¿ è¦ãããã¾ãã