Wednesday, April 14, 2010

A great way to get around the long loading request times on AppEngine

I wrote yesterday about my experimental project my-foc.us that is currently a prototype app running on Heroku. In parallel, I wanted to experiment with doing an AppEngine deploy but I got rather frustrated this morning by the both long and unpredictable cold loading request times. Even with some clever new work to manage the load time of JRuby apps, there is still a lot of work to be done to get the cold request load times under a reasonable limit (perhaps a three or four seconds?).

I think that Python AppEngine apps have the fastest cold request load times but I am not Python developer (very rusty!). I tried a Java app and the load times were very much better that JRuby, but then I ran across a great project that reduces the load time for Java apps by not using JDO and instead using the light weight objectify-appengine project. I am not sure what is the best way to accurately measure cold loading request times except for letting an app get swapped out (wait a few minutes with no requests) and manually time a browser refresh. Anyway, it looks like my loading request times using objectify-appengine are now almost always about a second with the worse time that that I measured being just over two seconds. The URL for my AppEngine experiment is my-focus.appspot.com.

The obvious problem with this "solution" is that it takes me about twice as long to develop a JSP based web app than using Rails or Sinatra. Still, if you want to get good performance with and reduce costs on AppEngine, then I feel that you need to conform to the requirements of the platform. Perhaps occasionally giving up the use of a favorite programming language and web framework is well worth the effort. (BTW, the loading request time is not much of a problem with Scala either but it is with Clojure - not quite as much overhead for initialization as JRuby but cold loading request times are about 10 seconds for me.)