Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Best Practice: Not creating HttpSessions in JSPs by default

Harvey Gunther (hgunther@us.ibm.com), Senior Performance Analyst, IBM
Harvey Gunther is a Senior Performance Analyst with the IBM WebSphere Product Development team in Raleigh, North Carolina.

Summary:  This best practice recommends that you do not create HttpSessions in JSPs by default to improve performance.

Date:  08 Aug 2001
Level:  Intermediate

Activity:  4183 views
Comments:  

Introduction

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

Recommendation

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
Avoiding JSP File HttpSession By Default

Alternative

There is no alternative to this best practice. Do not take this default if you do not require a HttpSession.


Resources

About the author

Harvey Gunther is a Senior Performance Analyst with the IBM WebSphere Product Development team in Raleigh, North Carolina.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=13207
ArticleTitle=Best Practice: Not creating HttpSessions in JSPs by default
publish-date=08082001
author1-email=hgunther@us.ibm.com
author1-email-cc=