views:

170

answers:

2

I'm not new to improving my cold start time, I've spent many hours trying different things. I'd like if possible to know exactly what the Google App Engine does during a cold start.

I have a log statement as described here http://code.google.com/intl/nl/appengine/kb/java.html#performance to show when my code first gets control.

I have two apps that I have been testing, one is simple, and my code first gets control after about 1 second.

The other one has lots of files and stuff and my code first gets control after about 2 seconds. This one doesn't use any more libraries than the other one, however it does have a lot more jsps and java classes.

Could simply having more java and jsp classes cause slower cold start, even if the class isn't used?

+1  A: 

That article is a pretty good resource. A little later after the log statement part:

How can I speed up loading requests?

Here are a few suggestions:

  1. Perform application initialization lazily, rather than eagerly, so it doesn't all occur within a single request.
  2. Share expensive initialization between JVMs. For example, put data which is expensive to read or compute into memcache, where it can be quickly read by other JVMs during startup.
  3. Move initialization from application startup to build-time where reasonable. For example, convert a complex datafile into a simple, quick-to-read datafile in your build process.
  4. Use slimmer dependencies. For example, prefer a library that is optimized to your task, as opposed to a large library that performs very heavy initialization.
Jason Hall
precompilation is enabled by default in 1.3.1
Peter Recore
Oh cool, didn't realize.
Jason Hall
actually, I don't think items 1, 2, and 3 should come into play here, because the extra time is happening before contextIntialized is being called. The classloader might have to do more work up front if you have more classes in your project, which might mean #4 is involved.
Peter Recore
+2  A: 

I found this article helpful: http://www.answercow.com/2010/03/google-app-engine-cold-start-guide-for.html

Mats