File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Heavy use of HTTPSession Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Heavy use of HTTPSession" Watch "Heavy use of HTTPSession" New topic

Heavy use of HTTPSession

Suresh patel
Ranch Hand

Joined: Sep 13, 2007
Posts: 32
I just changed my project and the new project I am going to work has huge huge usage of HTTPSession .
Can some body tell me how can I replace it ..
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63839

Replace what?

[Asking smart questions] [About Bear] [Books by Bear]
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Originally posted by Rushit patel:
I just changed my project and the new project I am going to work has huge huge usage of HTTPSession .
Can some body tell me how can I replace it ..

Is this your plan . You are going to heavily use HTTPSession and replacing it(HTTPSession) with something else would improve performance. I do not think so.

HTTPSession are ready to use stuff to store user specific data , but yes , try to avoid putting unnecessary objects into it.Better to keep it small and as soon as work of an object is over , remove it.

Rahul Bhattacharjee
LinkedIn - Blog
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
From some loudmouth on the web ...

Web applications often have to hold some information about the user for the time the user is browsing the site, say a shopping cart with several items in it. Designers have many choices about where to put such data. Here are a few:

1. In Java or COM objects in memory
2. In server "session" storage
3. In a cookie
4. In hidden fields on the HTML page
5. In an XML data island on the page
6. Encoded on the URL
7. In temporary session storage on a database
8. On the real database of record

Give you any ideas?

I worked one vendor framework that put too much on the session and caused memory problems. Some of it was really dumb; copies of very large objects that were never really used again, but we had a difficult time pruning others off. Once it was small enough, we turned on the WebSphere option to store sessions in the database to support clustering.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

It sounds like you've already come to the conclusion that the heavy use of session binding is a bad thing. Have you done any testing to prove this?
Is this really a bottleneck to performance or are you just assuming that the heavy use of the session object is bad?

In certain types of apps, proper use of the session object can greatly improve efficiency by cutting down on redundant object creation, disk I/O, and/or database access.
[ September 13, 2007: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: Heavy use of HTTPSession
It's not a secret anymore!