Do not create HttpSessions in JSPs by default. JSPs create HttpSessions by default. If you do not need an HttpSession, you can enhance performance by simply not taking the default with a one line JSP directive. Lab measurements have yielded a 5% performance throughput when this default is not used.
This best practice applies to the following product, version, and platform:
- WebSphere Application Server Base, all platforms, versions 3.0.2.x, 3.5.x, 4.0
Performance best practices find performance benefits by simply avoiding defaults. By default, JSP files create HttpSessions. This is in compliance with J2EE to facilitate the use of JSP implicit objects, which can be referenced in JSP source and tags without explicit declaration. HttpSession is one of those objects. If you do not use HttpSession in your JSP files, then you can save some performance overhead with the following JSP page directive:
<%@ page session="false"%>
Figure 1. Avoiding JSP File HttpSession By Default
There is no alternative to this best practice. Do not take this default if you do not require a HttpSession.