I was thinking filter, but I landed on this instead. Write an
HttpServlet implementation that wraps DispatcherServlet. This wrapper
will have an instance variable that holds a reference to a
DispatcherServlet. If the variable is empty then the wrapper goes and
pulls an instance of DispatcherServlet out of memcache, and then just
acts as a pass through for all requests.
With the first ever request the DispatcherServlet along with the whole
application framework is built and pushed into memcache by the
wrapper. When the next JVM is spun up, whether from being idle or to
scale up, the only thing that gets initialized is this lightweight
wrapper instance. The DispatcherServlet along with the whole
application framework is sitting in memcache the whole time and
doens't have to be rebuilt every time.
The wrapper will add a little more overhead to each request, but the
offset may be worth it, especially for low traffic sites that are
getting idled.
The issue that I have not resolved is whether the DispatcherServlet
will fit in memcache with the 1 meg limit. I have no idea how big my
DispatcherServlet actually is with the whole framework and all my
beans. If it is too big for mamcache then blob store or data store may
be alternatives.
If JDO takes too long to init then this wrapper servlet could bypass
that and just use the low level API just to pull this one entity. That
should have less overhead.
class WrapServlet implements HttpServlet
{
DispatcherServlet disp;
Cache cache;
public response service(request, response)
{
if (disp == null) {
disp = cache.get(dispKey);
if (disp == null) {
disp = new DispatcherServlet();
cache.put(dispKey, disp);
}
}
return disp.service(request);
}
}
On Apr 26, 5:55 am, Toby <[email protected]> wrote:
> ... humm, it sounds like an idea. But I am not sure it works. I
> learned that even the use of JDO is slowing down thestartup. So I
> imagine if there was a way to optimize that with the datastore they
> would have done it?
> How would you want to put this in place? With a filter?
>
> On Apr 25, 5:38 am, tazdevil78 <[email protected]> wrote:
>
>
>
> > I am still new to GAE, but could we not push an instance of
> > DispatcherServlet into MemCache or the datastore?
>
> > Then when the application idles we can pull the instance back out of
> > storage instead of creating a new instance.
>
> > Is that not what Google is trying to say in their FAQ, "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."
>
> > Maybe I am missing something obvious....
>
> > On Feb 26, 2:50 pm, luijar <[email protected]> wrote:
>
> > > Nope, I am still seeing it. It's quite frustrating. I even tried to
> > > reduceSpringinit time by removing schema validation from the
> > > application context init. But, that does not seem to work. I am
> > > usingSpringannotations and component scanning to autowire my beans, I
> > > wonder if using plain XML configuration will make autowiring faster.
>
> > > On Feb 23, 9:14 pm, charming30 <[email protected]> wrote:
>
> > > > Has the above mentioned "offline precompilatio" in 1.3.1 been able to
> > > > solve your issue, I plan to useSpringon Java for my Business App
> > > > which is complex and could be based on SOA. Kindly let me know if your
> > > > issue was resolved or reduced by using the above fix.
>
> > > > On Feb 20, 12:05 am, luijar <[email protected]> wrote:
>
> > > > > I believe my development environment was on 1.3.0. That might be
> > > > > something to look at, although it seems that probably it's a very
> > > > > small overhead, do you have any metrics that would give some evidence
> > > > > as to how much overhead is "offline precompilation" adding?
>
> > > > > Thanks
>
> > > > > On Feb 18, 2:04 pm, Don Schwarz <[email protected]> wrote:
>
> > > > > > Have you deployed your application with the 1.3.1 SDK? That
> > > > > > release turned
> > > > > > on "offline precompilation" by default, which is an optimization
> > > > > > that may
> > > > > > help.
>
> > > > > > On Thu, Feb 18, 2010 at 7:59 AM, Alex <[email protected]> wrote:
> > > > > > > Hi,
>
> > > > > > > It appeared that long init problem is well known for Grails users:
> > > > > > >http://jira.codehaus.org/browse/GRAILSPLUGINS-1736
>
> > > > > > > I wasted couple of weeks to create app I cannot run. Hope that
> > > > > > > SpringSource and Google can solve the issue.
>
> > > > > > > On Feb 17, 7:41 pm, Stephan Hartmann <[email protected]> wrote:
> > > > > > > > The problem is that the initialization of your app takes longer
> > > > > > > > than 30
> > > > > > > > seconds.
> > > > > > > > Pinging your app doesn't help when the app is restarted due to
> > > > > > > redeployment
> > > > > > > > or maintenance, or when high traffic demands a second instance.
>
> > > > > > > > You should try to reduce your startup time.
>
> > > > > > > > regards,
> > > > > > > > Stephan
>
> > > > > > > > 2010/2/17 luijar <[email protected]>
>
> > > > > > > > > Great, all of our projects areSpringenabled lol. But I guess
> > > > > > > > > it's
> > > > > > > > > good that we are not the only ones seeing this, hopefully it
> > > > > > > > > gets a
> > > > > > > > > little more visibility. We have a cron job (1 min) that tries
> > > > > > > > > to keep
> > > > > > > > > our application alive by hitting a URL, but it does not do a
> > > > > > > > > very good
> > > > > > > > > job. It's frustrating and we don't even have access to the
> > > > > > > > > 500 page to
> > > > > > > > > tell the user to retry or go somewhere else.
>
> > > > > > > > > On Feb 17, 11:21 am, oth <[email protected]> wrote:
> > > > > > > > > > Yes we have seen this problem a lot. Per our tests, an
> > > > > > > > > > application
> > > > > > > > > > becomes idle after a minute of non activity. So, the
> > > > > > > > > > unfortunate
> > > > > > > > > > reality is that you need to keep your app alive by
> > > > > > > > > > simulating
> > > > > > > activity
> > > > > > > > > > on it. Or go the nonSpringroute.
>
> > > > > > > > > > Thanks
>
> > > > > > > > > > On Feb 16, 4:14 pm, luijar <[email protected]> wrote:
>
> > > > > > > > > > > Hello Google App Engine forum,
>
> > > > > > > > > > > We have been seeing ever since we deployed our
> > > > > > > > > > > applications
> > > > > > > > > > > (currently 3 of them) that when our application instances
> > > > > > > > > > > become
> > > > > > > idle
> > > > > > > > > > > (they have not been hit for x amount of seconds)
> > > > > > > > > > > subsequent
> > > > > > > requests
> > > > > > > > > > > return with a 500 response. Logs show a hard deadline
> > > > > > > > > > > exceeded
> > > > > > > error
>
> > > > > > > > > > > com.google.apphosting.runtime.HardDeadlineExceededError:
> > > > > > > > > > > This
> > > > > > > request
> > > > > > > > > > > (32306ebe63b71ab0) started at 2010/02/12 20:39:11.984 UTC
> > > > > > > > > > > and was
> > > > > > > > > > > still executing at 2010/02/12 20:39:41.225 UTC.
> > > > > > > > > > > at
>
> > > > > > > com.google.appengine.runtime.Request.process-32306ebe63b71ab0(Request.java)
>
> > > > > > > > > > > And the first line of the log message has the following :
>
> > > > > > > > > > > 02-12 12:39PM 14.088
>
> > > > > > > > > > > javax.servlet.ServletContext log: InitializingSpringroot
> > > > > > > > > > > WebApplicationContext
>
> > > > > > > > > > > Question:
> > > > > > > > > > > Has anyone else seen this behavior? How long does it take
> > > > > > > > > > > for an
> > > > > > > > > > > application instance to become idle?
>
> > > > > > > > > > > Thanks
>
> > > > > > > > > --
> > > > > > > > > You received this message because you are subscribed to the
> > > > > > > > > Google
> > > > > > > Groups
> > > > > > > > > "Google App Engine forJava" group.
> > > > > > > > > To post to this group, send email to
> > > > > > > > > [email protected].
> > > > > > > > > To unsubscribe from this group, send email to
> > > > > > > > > [email protected]<google-appengine-java%2B
> > > > > > > > > [email protected]>
> > > > > > > <google-appengine-java%[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 forJava" group.
> > > > > > > To post to this group, send email to
> > > > > > > [email protected].
> > > > > > > To unsubscribe from this group, send email to
> > > > > > > [email protected]<google-appengine-java%2B
> > > > > > > [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
> > athttp://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
> athttp://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.