Hi Ikai, i wonder what exactly happens in a loading request before the first component (piece of code) of an app is hit? In my case it is a ServletContextListener and the time between the first log entry of the container for the request and the the log entry from my contextInitialized method takes more than 5 seconds, e.g.:
03-04 *10:23AM 27.831* /about.html 200 8958ms 6483cpu_ms 8api_cpu_ms 1kb Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe) - - [04/Mar/2010:10:23:36 -0800] "GET /about.html HTTP/1.1" 200 1606 "" "Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.8) Gecko/20100202 Firefox/3.5.8 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)" "" W 03-04 *10:23AM 33.142* StartupListener contextInitialized: context initialization starting at: Thu Mar 04 18:23:33 UTC 2010 Is this to be expected as normal? My app is also cycled out after 1 minute or so of inactivity. Regards, Stephan 2010/3/4 Ikai L (Google) <[email protected]> > Michael, > > (Molson from the IRC office hours?) > > Some small percentage of your application's requests will always be > loading requests, as this is us spinning up a new instance of your > application to either grow for capacity or tearing down your instance > and putting it back up as resource allocation demands. We can't > predict when this will happen. You may want to star this issue: > > http://code.google.com/p/googleappengine/issues/detail?id=2456 > > Startup time is generally a function of several different things: > > - Spinning up the JVM (Relatively cheap, but on the order of magnitude > of 500ms - 1s) > - How many dependencies are you loading? (Relatively cheap compared to > JVM spinup) > - Framework init (Can be VERY expensive - loading up a dynamic > language runtime will always take a few seconds. Some frameworks will > also scan every class in your classpath. Spring, for instance, does > this to look for annotations eagerly on init time) > > Strategies to counteract these factors include optimizing for lazy > loading, which spreads the total load time across acess to several > different resources. Not many existing frameworks do this. > > As your application grows, loading requests should account for a > smaller and smaller percentage of your total requests. I've seen > solutions with rich applications that show a static page loading > dynamic resources as a general landing page. This doesn't solve the > load time solution, but it meets the user halfway by making a web app > appear to load faster as opposed to causing a user's brower window to > be blank while waiting for a request to be handled. > > On Tue, Mar 2, 2010 at 4:32 PM, Michael <[email protected]> wrote: > > Looking at my App Engine logs, I see troubling results when viewing > > the response times for requests. In my current log set, the first 80 > > requests all complete in under 100 ms with less than 100 ms of cpu or > > api time. Then, oddly, the 83rd request, from the exact same client > > with the exact same request parameters, takes 7,192 ms to respond with > > 10,123 cpu ms (and 12 api ms). > > > > These kinds of spikes are dotted throughout my logs. They occur in > > less than 1% of cases, as far as I can tell, but the spikes are not > > just large; they're enormous. I know for a fact that the request > > parameters and returned data were identical to the requests several > > seconds before and after from the same client, but the request took > > about 20 times longer to serve. > > > > Does anyone know what causes these large spikes in response time, and > > can anyone share tricks to help alleviate these spikes? I know that > > it is somehow related to instantiating the JVM, but I don't know: > > - how to reduce the startup time of the JVM > > - how to predict when GAE will try to start a new JVM > > > > Thanks in advance for any advice, > > - Michael > > > > -- > > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > > To post to this group, send email to > [email protected]. > > To unsubscribe from this group, send email to > [email protected]<google-appengine-java%[email protected]> > . > > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > > > > > > > -- > Ikai Lan > Developer Programs Engineer, Google App Engine > http://googleappengine.blogspot.com | http://twitter.com/app_engine > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine for Java" group. > To post to this group, send email to > [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-appengine-java%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine-java?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
