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:
<html>
<body>
All the numbers from 0 to 100.<br />
<%
for (int i=0; i < 100; i++)
{
out.println(i + ", ");
}
out.println(100);
%>
</body>
</html>
Jasper generates the following:
public void _jspService(HttpServletRequest request,
HttpServletResponse response)
throws java.io.IOException, ServletException {
...
HttpSession session = null;
...
pageContext = _jspxFactory.getPageContext(this, request,
response,
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 ([EMAIL PROTECTED])
(801)861-5322
Novell, Inc., The Leading Provider of Net Business Solutions
http://www.novell.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]