tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 49176] New: Jasper in Dev Mode Is Memory Inefficient
Date Fri, 23 Apr 2010 13:31:53 GMT

           Summary: Jasper in Dev Mode Is Memory Inefficient
           Product: Tomcat 6
           Version: 6.0.24
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Jasper

org.apache.jasper.compiler.Compiler.compile(), ~line 357 has this code:

            // Only get rid of the pageNodes if in production.
            // In development mode, they are used for detailed
            // error messages.
            if (!this.options.getDevelopment()) {
                pageNodes = null;

Turns out this has a pretty substantial impact on the heap usage for JSPs.  Our
application has ~2300 JSPs, which if all are compiled and loaded when Jasper is
in production mode yields roughly an 80m overhead.  However, if all are
compiled and loaded while Jasper is in development mode, the overhead is ~1.8g
- yes, that's gigabytes.

For most development environments this won't be an issue b/c all of the JSPs
won't need to be compiled and loaded, and one would assume that in production
you turn off development mode.

However, for reasons outside the scope of this bugzilla issue, we can't turn
this off in production.

However, it seems like a very small change might result in big big savings for
those who might also be like us, plus also just raw savings in development

If my analysis is correct (and I'm all ears to hear that it is not), the
pageNodes data is really only used after compilation if a JSP compile error is
enountered.  The pageNodes data will be picked up and used in generating a more
detailed error page.

So... can the Compiler.compile() method ALWAYS clear this out if there is no
exception in the compilation?  This would give the best of both worlds - huge
memory savings plus detailed error pages.

Final note: to prove this out, we wrapped the JspServlet in our own servlet so
which basically just proxies the Jasper JspServlet EXCEPT that when the
JspServlet.service() method completes, we check to see if the JSP was just
compiled, and if it was, we reflectively set the pageNodes property of the
associated Compiler to null.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message