Web tier: servlets, JSP, Web frameworks: How to calculate exactly how much is big the Session object ?

  1. Hi all,
    I'd like to know if it's possible to calculate the size of the Session object in a web application so that I can forecast how much memory my application will need for example if users will increase by a certain %
    Thanks in advance
  2. I donno you exact requirement But I guess you can use a session listener which keeps track of objects that are added to the session object. All you have to have is a counter kind of stuff that can be updated when ever an objcet is binded.

    If you are able to calculate the size (m/y footprint) of each java object (is it possible !!!) then you problem is solved by using a session listener.
  3. Or simply use getAttributeNames() method in the session interface & iterate thru each of the object binded.
  4. There is an OpenSource utility available called MessAdmin. You can make use of this tool to get the information of your session. http://messadmin.sourceforge.net/ Hope this helps. Kevin.