JSP get compiled to a class extending HttpServlet
on first access/request. Some servletcontainers will compile it directly during startup (or are configureable to) so that you won't notice the "lag". Others doesn't support it and you then need to precompile the JSP files yourself and deploy your WAR with it.
I've never used it, so I can't answer from top of head, but a quick glance in its Java FAQ learns me that you can enable precompilation on startup by adding the following entry to appengine-web.xml
file:
<precompilation-enabled>true</precompilation-enabled>
Update: as per the Performance section of the appengine documentation, it appears to spin up (and off) JVM's on demand, which may cause "loading requests". Here's an extract of the documentation:
What is a loading request?
Some requests run slower because App
Engine needs to create a new Java
virtual machine to service the
request. We call that kind of request,
a Loading Request. During a loading
request, your application undergoes
initialization (such as class loading,
JIT compiling, etc) which causes the
request to take longer.
For slow requests which are already
close to App Engine's request
deadline, the extra initialization can
push it past the deadline, causing a
DeadlineExceededException. What causes
loading requests?
App Engine spins up JVMs on demand, so
there are several reasons why you may
receive a loading request:
- You just uploaded a new version of your application.
- Your application may not be getting any traffic.
- Your traffic has become high enough to need another JVM to scale.
You can expect that during the course
of developing your application, you
will often experience the first two
scenarios. In comparison, for a
production app receiving even a very
small but steady amount of traffic,
loading requests are relatively
infrequent.
In other words, this is not solveable in any programmatic way. Either just live with it or consider a dedicated server with a fullworthy servletcontainer.