Riyad Kalla wrote:
Mike,
Good suggestions. I was dealing with something like this recently and decided that for me, adding caching at the DAO level:
e.g. List userList = UserDAO.getAllUsers();
would offer the biggest performance benefit since it would be:
(a) application wide, instead of per session
(b) returned Lists are 4-byte pointers to the actual list object cached in the DAO
(c) The DAO itself handles all manipulation of those types, so it knows when to invalid its own cache (on inserts/updates/removes)
What do people think about this strategy? (Before I spend a week implementing it :)
Best, Riyad
On Thursday 27 May 2004 08:49 am, Mike Zatko wrote:
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]
--------------------------------------------------------------------- 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]