Tom Clarke wrote:
>
> More of a concern is that every single JSP page gets compiled to a servlet.
>
> This becomes an issue where (as commonly do with ASP here) use JSP for every
> page on the site to get say a parameterized include feature, or browser
> customization.
>
> You could get the case where the entire Web site would be loaded into
> memory, which could become quite unscalable.
>
> It is possible to have JSP pages garbage collectable by giving each its own
> classloader, but I don't know if either this method is used by the JSP
> engines, or whether a typical runtime uses it effectively.

JSP pages are servlets so the discussion can be limited to how an engine
can deal with servlets in general. The Servlet API defines the life cycle
of a servlet through the init(), service() and destroy() methods. A servlet
engine is free to unload a servlet any time it chooses to do so, e.g. to
preserve memory, as long as it always calls destroy() first and then calls
init() before service() when it reloads the servlet. In order to gain any
memory when unloading, it must also use a separate class loaders for each
servlet (don't quote me on that but I believe so).

As far as I know, no servlet engine has this memory preservation feature
today but most already use separate class loaders for other reasons so
it shouldn't be too hard to implement.

Another question is of course how big of an issue it is. Based on the examples
I have, even fairly complex servlet is rarely larger than 15 KB. A site with
1,000 JSP pages would then need 15 MB to have them all loaded. Sure, it's
a bit of memory but hardly extreme. As someone else said, how much stuff you
put in the sessions is probably a greater concern since it need to be
multiplied with the number of active sessions. Then again, some servlet
engines can serialize session data to disk, so there are ways around that
too.

--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JSP-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to