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.)

3 comments:

J.F. Zarama said...

good and relevant topic this one about the intial loading, latency, of AppEngine apps.

I am dealing with the very same issue and have reduced the initial loading time to about 3 seconds from 10++.

However, I seem unable to get the near instant time I get with your app; if you can share more info it will be great and thanks for pointing me to objectivity-appengine,

thanks.

J.F. Zarama said...

just a follow-up on this; I redeployed my app using objectivity-appengine and 1.3.2 and response is now under a second;

thanks again for the blog entry re subject; it helped me address an issue that had bothered me for a while;

Mark Watson, author and consultant said...

Hello J.F., great! AppEngine is great for an inexpensive deployment platform but it does take some effort.