tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Tulley" <>
Subject Glen: One more item to include in Tomcat performance presentations
Date Tue, 25 Nov 2003 22:51:23 GMT
I have been looking through the ApacheCon Tomcat performance
presentation while simultaneously working on a performance / memory
problem with Tomcat 4.x, and I have one more item that I would add to
the presentation:

Make sure JSP pages that do not deal with the session have "<%@ page
session="false" %>" in them.  Consider the following brain-dead JSP:

  All the numbers from 0 to 100.<br />
    for (int i=0; i < 100; i++)
      out.println(i + ", ");

Jasper generates the following: 

  public void _jspService(HttpServletRequest request,
HttpServletResponse response)
        throws, ServletException {
    HttpSession session = null;
      pageContext = _jspxFactory.getPageContext(this, request,
      			null, true, 8192, true);
      session = pageContext.getSession();

Here the session object is totally unneccessary (both in the
getSession, and in the 3rd-to-last, "true" argument ot the
getPageContext call).  Creating a session adds to the latency of the
request, and worse(in my case, doing some load-testing), adds memory
that is not freed up until the session timeout expires - 30 minutes by
default, possibly creating a situation where the memory is maxed out on
the JVM process.

Hitting very simple JSPs on my system (600Mhz Single proc machine
-Xmx256m, 75 processors going directly to 8080), caused about a 25%
performance gain (~515 req/s up to ~640 req/s)  Very significant.

I just thought it worth passing on since it seems useful and (AFAIK) is
not mentioned anywhere in docs.

Jeff Tulley  (
Novell, Inc., The Leading Provider of Net Business Solutions

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

View raw message