I'm not sure how long Tomcat will cache the JSP, I would assume that
it's dependent on how you've got your site configured (how much heap
space you have allocated), how many servlets/JSPs you have and what kind
of usage patterns you see.  I would guess that Tomcat will unload
servlets if memory gets tight, starting with the least-recently-accessed
first.  Remember, though, that only one instance of the servlet is ever
loaded, so even if your servlet is getting hundreds of hits a minute,
your memory usage shouldn't climb that fast.

You might be able to preload all your JSPs by using the
<load-on-startup> tag.  Something like:

<servlet>
    <servlet-name>MyServlet</servlet-name>
    <jsp-file>/jsp/MyPage.jsp</jsp-file>
    <load-on-startup>1</load-on-startup>
</servlet>

Failing that, you might want to check out the Jakarta mini-browser, or a
text-based browser like Lynx.  It should be possible to script either
one of these to visit all your pages.  If you're worried about
interactions, or if security is an issue (e.g., you can't access pages
unless you log in), you might want to add a parameter like
"?preload=true" to the URL, and have your JSPs or servlets Do The Right
Thing when they see it.  That's starting to get a little involved,
though...

---
Tracy Nelson / Nelnet Business Solutions
402 / 617-9449

| -----Original Message-----
| From: Frank Niedermann [mailto:[EMAIL PROTECTED]
| Sent: Tuesday, 26 September, 2006 00:50
| To: users@tomcat.apache.org
| Subject: RE: Precompiled JSPs after Tomcat restart
| 
| 
| Tracy,
| 
| thanks for clarification.
| 
| How long will Tomcat cache a loaded JSP?
| 
| And is there a way to tell Tomcat or the classloader to load every
| single JSP after startup?
| 
| Do you have an example of such a script? (ATM I have no idea how
| to do this)
| 
| Thanks,
|   Frank
| 
| Do you
| 
| Tracy Nelson-2 wrote:
| >
| > What you're seeing is normal servlet/JSP processing.  After you
restart
| > Tomcat, the classloader has to load the servlet/JSP.  Once it has
done
| > this, the servlet/JSP is cached so it doesn't need to be reloaded.
The
| > JSP files shouldn't be compiled again unless they change.  The
server
| > should check the last-modified time on the JSP when it receives a
| > request, and compare that to the creation time of the compiled
class,
| > and recompile if necessary.
| >
| > If you can (depending on how complex your application is), you might
| > want to create a small script to access every page in your
application,
| > then run that as the last step in your Tomcat startup script.  It
| > doesn't matter if the page is accessed "correctly" (i.e., passed any
| > parameters it needs), it'll still be loaded and cached.
| >
| > ---
| > Tracy Nelson / Nelnet Business Solutions
| > 402 / 617-9449
| >
| > | -----Original Message-----
| > | From: Frank Niedermann [mailto:[EMAIL PROTECTED]
| > | Sent: Monday, 25 September, 2006 04:48
| > | To: users@tomcat.apache.org
| > | Subject: Re: Precompiled JSPs after Tomcat restart
| > |
| > |
| > | I've found the .java and .class files in a new sample application.
| > |
| > | I still don't understand if the compiled class files are used
after
| > | Tomcat restart or if the JSP files will get compiled again.
| > |
| > | I'm asking because my application (Matrix from MatrixOne) is
| > | very slow after restarting Tomcat. After visiting (and compiling?)
| > | every JSP page it gets faster until next Tomcat restart.
| > |
| > | Can anybody clarify or help me out with hints to documentation?
| > |
| > | Thanks.
| > |
| > |
| > | Michael Zoller wrote:
| > | > Frank Niedermann wrote:
| > | >> Hello,
| > | >>
| > | >> is it right that Tomcat stores all compiled JSP sites in
| > | >> Tomcat5\work\Catalina\localhost\application\org\apache\jsp?
| > | >>
| > | > yes.
| > | >> After a restart of Tomcat I still see all the .class files
| > | >> in above mentioned directory, does that mean that these files
| > | >> do not have to be compiled again at first access to them?
| > | >>
| > | > Educated guess: The servlets/jsp still have to be executed. Once
| > they
| > | > are loaded into memory they will execute faster because caching
| > | > mechanisms (harddisk and OS) apply.
| > | >
| > | >
| > | > Michael
| > | >
| > | >
| >
---------------------------------------------------------------------
| > | > To start a new topic, e-mail: users@tomcat.apache.org
| > | > To unsubscribe, e-mail: [EMAIL PROTECTED]
| > | > For additional commands, e-mail: [EMAIL PROTECTED]
| > | >
| > | >
| > |
| > |
| > |
---------------------------------------------------------------------
| > | To start a new topic, e-mail: users@tomcat.apache.org
| > | To unsubscribe, e-mail: [EMAIL PROTECTED]
| > | For additional commands, e-mail: [EMAIL PROTECTED]
| > |
| > |
| > |
| > |
| > |
| > |
| > | --
| > | View this message in context:
http://www.nabble.com/Precompiled-JSPs-
| > | after-Tomcat-restart-tf2303735.html#a6483314
| > | Sent from the Tomcat - User mailing list archive at Nabble.com.
| > |
| > |
| > |
---------------------------------------------------------------------
| > | To start a new topic, e-mail: users@tomcat.apache.org
| > | To unsubscribe, e-mail: [EMAIL PROTECTED]
| > | For additional commands, e-mail: [EMAIL PROTECTED]
| >
| >
| >
---------------------------------------------------------------------
| > To start a new topic, e-mail: users@tomcat.apache.org
| > To unsubscribe, e-mail: [EMAIL PROTECTED]
| > For additional commands, e-mail: [EMAIL PROTECTED]
| >
| >
| >
| 
| --
| View this message in context: http://www.nabble.com/Precompiled-JSPs-
| after-Tomcat-restart-tf2303735.html#a6500771
| Sent from the Tomcat - User mailing list archive at Nabble.com.
| 
| 
| ---------------------------------------------------------------------
| To start a new topic, e-mail: users@tomcat.apache.org
| To unsubscribe, e-mail: [EMAIL PROTECTED]
| For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to