I personally think its too big. Large amounts of data like that should be put in request scope so that it gets flushed out of memory right away. If you need the data to be persistent through the user's session lifetime, mabye try serializing it to a database. Of course, different situations call for different solutions. Also, I would try and replace your Vector with a non-synchronized Collection like an ArrayList or LinkedList unless you have some sort of mutlithreaded access to this collection.

Riyad Kalla wrote:

Larry,
Good question. I am curious what others think about this situation as well.

On Thursday 27 May 2004 08:24 am, Zhang, Larry (L.) wrote:


It is apparent true that if the session size is big, the performance will
be negatively affected. The question is that how to actively control the
size of session.

Let's discuss this question:

I have a page which displays all the subordinates of a manager, for some
reasons I want to create a List or a Vector containing all the subordinates
and put this List or Vector to the session. Each element in the List or
Vector is a Java object, Employee( each Employee object has 200 String
attributes, among which 5 are needed to be displayed on the screen)

A picture of this situation is:

                                Vector allSubordinates = new Vector();
                                        allSubordinates.add(Employee1);
                                        allSubordinates.add(Employee2);
                                        .......

                                        allSubordinates.add(Employee1000);

session.setAttribute("allSubordinates",allSubordinates);

Do you think this actually makes the session very big?


Then what will be the improvement of the following? Instead of add all the employee objects, we create a very small object called DisplayObject, which just contains the 5 attributes required on the screen.

                                Vector allSubordinates = new Vector();
                                        allSubordinates.add(DisplayObject1);
                                        allSubordinates.add(DisplayObject2);
                                        .......

                                        allSubordinates.add(DisplayObject1000);

session.setAttribute("allSubordinates",allSubordinates);

Your sharing of opinion is appreciated!

Thanks.

Larry



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






--

Michael H. Zatko
WebSphere Developer
Boscov's Information Services
Work: 610-929-7317
Home: 610-562-2407


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to