tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob Hookom" <hooko...@uwec.edu>
Subject RE: howto avoid overuse of session object?
Date Fri, 02 Aug 2002 07:33:00 GMT
I agree, stick to the session itself for purposes of scaling later, just
be smart about the objects you put in there, IE, use singletons and
factories for instances, etc.  There's no need to write your own session
handler.

Jacob Hookom 
Comprehensive Computer Science 
University of Wisconsin, Eau Claire 


-----Original Message-----
From: Ralph Einfeldt [mailto:ralph.einfeldt@uptime-isc.de] 
Sent: Friday, August 02, 2002 1:46 AM
To: Tomcat Users List
Subject: AW: howto avoid overuse of session object?

Just to throw in anothe opion :)

I agree with you.

As I understand you want to exchange object between 
two requests of the same session.
If you have information that has a scope that is below 
a session, I don't see any reason to store it with a
scope that is above the session (application or context).

I don't see any benefit at all but several disadvantages. 
If you store the information in the session you have 
following advantages:
- If you have errors in your applications that sometimes 
  forget to remove object, you can at least be shure that 
  they will be removed at the end of the session. (Of 
  course you can implement your own code in a Listener
  that destroys the data from the context or application,
  but why implement something that is done by the container
  anyway)
- If you have to scale your site up to use a loadbalancer 
  with distributed session, this will work only if all
  informations that belong to a session are store in the 
  session (Or you have to write code that serializes the 
  data that you store

The only reason to store this data in a scope that is above
the session level, is to store it in a database instead of 
the memory (e.g. to implement your own distributed/failsafe 
sessions).

Of course it's good practice to reduce the objects in the 
session but not at the price to store them just in different 
scope in memory. What you can do, is reuse objects between 
sessions if the object are the same or to use references. 
E.g. if you have an application that implements a shopping
cart you just need the references to the products that are 
in the basket not the products itself.

In your case I would recommend to store the data in the 
session and to remove them on your own as soon as possible.

One additional advice: give the objects names by using a 
naming convention that makes it unlikely that you add, 
change or remove them by accident.

Ralph Einfeldt
Uptime Internet Solution Center GmbH
Hamburg, Germany
Hosting, Content Management, Java Consulting
http://www.uptime-isc.de 

> -----Urspr√ľngliche Nachricht-----
> Von: jeff.guttadauro@abbott.com [mailto:jeff.guttadauro@abbott.com]
> Gesendet: Donnerstag, 1. August 2002 22:33
> An: Tomcat Users List
> Betreff: Re: howto avoid overuse of session object?
> 
> Thanks, Cédric and Peter Lin, for your responses.  Both of 
> you seem to be saying that, instead of storing large objects 
> in the session object, 

--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.380 / Virus Database: 213 - Release Date: 7/24/2002
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.380 / Virus Database: 213 - Release Date: 7/24/2002
 


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message