This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Session size Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Session size" Watch "Session size" New topic
Author

Session size

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I'm looking for a piece of code that will return the session object size. Any ideas?
Thanks.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
Due to the basic structure of Java, you are never going to be able to get the in-memory size of a session. If all of your session storage objects are serializable, you could write the session to a file or a ByteArrayOutputStream and see how large the serialized form is.
Bill

------------------
author of:
 
jQuery in Action, 2nd edition
 
subject: Session size
 
Similar Threads
Websphere getting slow
size of objects in session
JSF Scalability
How to know size of a session
Is there a limit to the size of object that can be kept in a session?