tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Costin Manolache" <cos...@gmail.com>
Subject Re: What's about unloading policy of jsp-servlets ?
Date Fri, 03 Mar 2006 16:49:51 GMT
On 3/3/06, Yaroslav Sokolov <yarick123@gmail.com> wrote:
>    Actually I found this strings-problem as well. I even created a patch to
> test how it affects on memory filling.
>
>    The result was the next. When strings were stored outside of *.class files,
> number of loaded jsp-servlets increased about 3 times. Time of generation of
> *.jsp -> *.java -> *.class files was moderate decreased. But finally, all the
> memory were occupied by jsp-servlets and tomcat threw OOME exception...

The compile time is lower because the .java source is smaller.

Are you sure the soft strings were unloaded ? I would expect the
remaining .java/.class to be quite small for a static .html -
eventually it'll throw OOM, but after a lot of .html files.

But it's a separate issue - I agree that unloading unused jsps is the
most important.

The difficult question is - how does it affect the spec compliance ?
My understanding was that container is allowed to unload servlets and
jsps and webapps whenever he wants. The only problem I see is
servlets/jsps using fields - static or not, I assume people don't
expect them to go away and don't have code in destroy() to save state.
So it might break a lot of code.



Costin


>
> (I put strings to separated file, loaded them only of necessity and kept only
> soft references to these strings.)
>
> Regards,
> Yarick.
>
> Costin Manolache wrote:
> > Thanks for the patch...
> >
> > This is a well known problem, JSPs are not unloaded unless the entire
> > webapp is unloaded. And to make things worse - by default all JSP
> > static content is compiled to strings, that take all the memory. I
> > think we have ( or had ) an option to generate some non .class file -
> > which could be more easily managed.
> >
> > Unfortunately I'm not familiar enough with jasper code - but it looks
> > good to me. The model of keeping the entire jsp static content in
> > memory forever is IMO very broken... It may help cheat on some
> > benchmarks ( i.e. jsp versus html, etc ), but it's wrong for real
> > world.
> >
> >
> > Costin
> >
> > On 3/3/06, Yaroslav Sokolov <yarick123@gmail.com> wrote:
> >
> >>Hi,
> >>
> >>I have found, that once loaded jsp-servlets are never unloaded.
> >>
> >>To test I just configured tomcat to process *.html files by JspServlet
> >>and then traversed jdk documentation. The result was not very exciting -
> >>after browsing ~ 150 pages tomcat cried "java.lang.OutOfMemoryError: Java heap
space"
> >>and started not to work...
> >>
> >>So maybe it would be not a bad idea to try to keep in memeory just some fixed
> >>number of jsp-servlets ?
> >>
> >>I have written a sample implementation of such a policy, but it is not very elegant
> >>as internal structure containing jsp-servlets, it seems, was not designed for
such actions...
> >>
> >>Regards,
> >>Yarick.
>
> [skipped]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message