The initial posting sounds like an EJB question instead of one that is
Tomcat related.  Tomcat is considered a web application server and it
uses session objects (HttpSession) to represent user sessions.  It
doesn't handle EJBs at this point.  Session beans are exclusive terms
for EJB servers (e.g. JBoss, WebLogic, WebSphere, etc.)

If you want to determine memory usage of session objects in tomcat, the
answer will depend on the content/size of HttpSession and the number of
concurrent users.

If you really mean session beans in EJB, you need to differentiate the
types of session beans.  There are two types of session beans, stateless
and stateful (as of EJB spec 2.1).  Stateless session beans can be
pooled, so the memory usage for them would be the size of a bean object
times the size of the pool.  Stateful session beans can't be pooled, so
their memory usage would be the size of the bean times the number of
concurrent users.

The size of any java object is usually defined by its size on the heap,
determined by its instance data members.  The number of methods does not
matter.

ND

-----Original Message-----
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 14, 2006 1:35 PM
To: Tomcat Users List
Subject: Re: Size of session bean

That's an interesting question... looking at the code I wrote in Java 
Web Parts for the getSessionSize() method, I'm only taking into 
consideration the fields of the objects in session.  I think this is OK 
because IIRC, when an object is serialized, only the non-transient 
values are considered.  The methods don't factor into it because you 
aren't serializing the class definition, just the state of the object. 
If anyone knows differently I'd like to hear about it, but I believe how

that method works yields an accurate result.

If you want to see how I've done it, check out:

http://javawebparts.sourceforge.net

If you look at the javadocs, in the session package, there is a class 
called SessionSize that is used to get the size of a session object. 
You can grab the code and see how it's done, or just use it if that's 
your ultimate goal :)

Frank

Robert Palmer wrote:
> When calculating the size of a session bean to determine memory usage,

> what should be included and how is this done? Do the number of methods

> matter? The size of the code? Just the variables? I've read much about

> limiting the size of the session information but not how to do it. I 
> have some fairly large classes in session context but they don't store

> very much.
> 
> Thanks.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: [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]

Reply via email to