https://issues.apache.org/bugzilla/show_bug.cgi?id=49176

           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
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: scott.hamil...@plateau.com


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.
            // http://issues.apache.org/bugzilla/show_bug.cgi?id=37062
            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
mode.

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: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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

Reply via email to