GAE/J使ããªããã®è¨å®ããã¦ããï¼
ï¼èªåçã«ï¼ã»ã¼å¿ é ã¨ãªãè¨å®ãã¡ã¤ã«ã®ã¾ã¨ãã
ã¦ãããããªãã¡ã¬ã³ã¹èªãã°ãã¼ãã ãã©ã
ï¼ï¼sessionãæå¹ã«ãã & ã¯ãªã¢ã®è¨å®ããã
Javaã§session使ããªãã±ã¼ã¹ãªãã¦ããã®ãï¼
appengine-web.xmlãã«ãä¸è¨ã追å
<sessions-enabled>true</sessions-enabled>
GAE/Jã§sessionã使ãå ´åããã®ã¾ã¾ã ã¨Datastoreã«sessionæ
å ±ãæ®ã£ãã¾ã¾ãªã®ã§å®æçã«ã¯ãªã¢ããcronãè¨å®ãã
web.xmlãã«ãä¸è¨ã追å
<servlet> <servlet-name>_ah_sessioncleanup</servlet-name> <servlet-class>com.google.apphosting.utils.servlet.SessionCleanupServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>_ah_sessioncleanup</servlet-name> <url-pattern>/_ah/sessioncleanup</url-pattern> </servlet-mapping> <security-constraint> <web-resource-collection> <web-resource-name>session-cleanup</web-resource-name> <url-pattern>/_ah/sessioncleanup</url-pattern> </web-resource-collection> <auth-constraint> <role-name>admin</role-name> </auth-constraint> </security-constraint>
cron.xmlãã«ãä¸è¨ã追å
ãã®å ´åã12æéããã«æéåãsessionãã¯ãªã¢ãã¦ãããã
<cron> <url>/_ah/sessioncleanup?clear</url> <description>Clean up sessions</description> <schedule>every 12 hours</schedule> </cron>
ï¼ï¼ããªã³ã³ãã¤ã«ãæå¹ã«ãã
Deployæã«ããªã³ã³ãã¤ã«ãã¦ããããä½ãããªãã¨ååã¢ããªã±ã¼ã·ã§ã³èµ·åæã«ã³ã³ãã¤ã«ãããã
é度çã«30%ç¨åº¦æ©ããªããããã
å°æ¥ã®ãªãªã¼ã¹ã§ã¯ããã©ã«ãã§æå¹ã«ãªãã¿ãã
appengine-web.xmlãã«ãä¸è¨ã追å
<precompilation-enabled>true</precompilation-enabled>
ï¼ï¼éçãªã½ã¼ã¹ãæå®ãã
éçãªã½ã¼ã¹ï¼ç»åãJavascriptãCSSãã¡ã¤ã«ï¼ãæå®ãã¦ããã¨ãå°ç¨ã®ãµã¼ãã¼ã«é
ç½®ãã
èªè¾¼ãé«éåããããã
appengine-web.xmlãã«ãä¸è¨ã®ç¨ã«ãã¹ããã¡ã¤ã«ã追å
ã¯ã¤ã«ãã«ã¼ããæ£è¦è¡¨ç¾ãOK
<static-files> <include path="/css/**.css"/> <include path="/js/**.js"/> <include path="/img/**.png"/> <include path="/img/**.gif"/> <include path="/img/**.jpg"/> <include path="/favicon.ico"/> </static-files>
ï¼ï¼ç®¡çã³ã³ã½ã¼ã«ã«APIå¼ã³åºãå±¥æ´ãæé表示ç»é¢ã追å
CPU使ç¨æéãDatastoreã®Quotaãè¦ãäºã®ã§ãã管çãã¼ã«ã«ãªã¯ã¨ã¹ãæ¯/APIæ¯ã®å¦çæéãè¦ãã
管çç»é¢ã追å ãã¾ããããã§ããã«ããã¯ãåããï¼
追å ããã¨ç®¡çã³ã³ã½ã¼ã«ã®ã¡ãã¥ã¼ã®ä¸ã«Custom ã¨ããã®ã追å ããã¾ãã
å°ããã®ç®¡çç»é¢ãéãã¨ãã«ã¯ããä¸åèªè¨¼ãå¿
è¦ã«ãªãã¾ãã
ã¾ãã¯çµ±è¨æ
å ±ãåå¾ãããã£ã«ã¿ãè¨ç½®
web.xmlãã«ãä¸è¨ã®ããã«ãã£ã«ã¿ã¨ãµã¼ãã¬ããã追å
<servlet> <servlet-name>appstats</servlet-name> <servlet-class> com.google.appengine.tools.appstats.AppstatsServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>appstats</servlet-name> <url-pattern>/appstats/*</url-pattern> </servlet-mapping> <security-constraint> <web-resource-collection> <url-pattern>/appstats/*</url-pattern> </web-resource-collection> <auth-constraint> <role-name>admin</role-name> </auth-constraint> </security-constraint> <filter> <filter-name>appstats</filter-name> <filter-class> com.google.appengine.tools.appstats.AppstatsFilter </filter-class> <init-param> <param-name>logMessage</param-name> <param-value>Appstats available: /appstats/details?time={ID}</param-value> </init-param> </filter> <filter-mapping> <filter-name>appstats</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
次ã«ãappengine-web.xmlãã«ãä¸è¨ã®ããã«è¿½å
<admin-console> <page name="appstats" url="/appstats/"/> </admin-console>
ããã§ã°ã£ã¡ãï¼
ã»åèURL
http://code.google.com/intl/ja/appengine/docs/java/config/appconfig.html
http://d.hatena.ne.jp/hidemon/20100327/1269670906
http://blog.livedoor.jp/cbnanashi/archives/1045958.html
http://www.tdtsh.com/blog/archives/614