Re: Showing Tomcat Memory Utilization with 'top'

2010-06-23 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuck,

On 6/22/2010 5:00 PM, Caldarale, Charles R wrote:
 From: Christopher Schultz [mailto:ch...@christopherschultz.net]
 Subject: Re: Showing Tomcat Memory Utilization with 'top'

 Also, I believe VIRT includes memory shared with other processes
 
 Doesn't RES also include shared pages - anything that's in the memory
 map of the process?  (I can't remember exactly how that works, but
 the shared pages have to be accounted for somewhere.)

This is reaching the limits of my knowledge as well. I could imagine
shared memory not being counted against every process but it also
quite makes sense that it would.

 so if you have 50MiB of Java system classes loaded and a modern 
 JVM which shares them among running JVMs
 
 Note that only the client HotSpot JVM shares classes; the server
 version does not.  (The sharing is really class templates, not the
 class objects themselves.)

I didn't realize that the server JVM didn't share class templates. Do
you have any ideas why not? It seems to be a relatively cheap
optimization when multiple JVMs are in use, and shouldn't include too
much overhead for either the process or the OS if there's no actual
sharing going on in a single-JVM scenario.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwiPcQACgkQ9CaO5/Lv0PA9oACcCAVoKQZ3F9DG5iPmEusC0nSt
k/wAnjfHzZpGU2lceqY7cltkJ/EUiNk9
=sw+t
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Showing Tomcat Memory Utilization with 'top'

2010-06-23 Thread Caldarale, Charles R
 From: Christopher Schultz [mailto:ch...@christopherschultz.net]
 Subject: Re: Showing Tomcat Memory Utilization with 'top'
 
 I didn't realize that the server JVM didn't share class 
 templates. Do you have any ideas why not?

AFAIK, Sun just hadn't gotten around to it yet; don't know if it's in JRE 7 or 
not.  Class sharing is primarily of interest in environments where startup time 
is critical, and Sun didn't think that the server JVM would be subject to that 
issue.  However, with more and more 64-bit environments being available (eg, 
everybody's laptops) that have only a server JVM on them, that decision looks 
like it's no longer valid.  Note that the client and server JVMs are really two 
entirely different beasts, so the data structures from one are not easily 
translated to the other.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.



Showing Tomcat Memory Utilization with 'top'

2010-06-22 Thread Robinson, Eric
In top, my java processes all show an average VIRT size of about 250MB
and an average RES size of about 150MB. Most of them were started with a
64MB heap size. I have two questions:

1. Top shows 0k of swap usage, so the system is not swapping. In that
case, why is there a difference between the VIRT and RES numbers? My
understanding is that RES=CODE+DATA and VIRT=RES+SWAP. If swap=0, then
should not RES and VIRT be the same?

2. Where does the 64MB of java heap show up?

--
Eric Robinson



Disclaimer - June 22, 2010 
This email and any files transmitted with it are confidential and intended 
solely for Tomcat Users List. If you are not the named addressee you should not 
disseminate, distribute, copy or alter this email. Any views or opinions 
presented in this email are solely those of the author and might not represent 
those of . Warning: Although  has taken reasonable precautions to ensure no 
viruses are present in this email, the company cannot accept responsibility for 
any loss or damage arising from the use of this email or attachments. 
This disclaimer was added by Policy Patrol: http://www.policypatrol.com/

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Showing Tomcat Memory Utilization with 'top'

2010-06-22 Thread Caldarale, Charles R
 From: Robinson, Eric [mailto:eric.robin...@psmnv.com]
 Subject: Showing Tomcat Memory Utilization with 'top'
 
 1. Top shows 0k of swap usage, so the system is not swapping. In that
 case, why is there a difference between the VIRT and RES numbers?

Linux always allocates more virtual space than is actually used (thread stack 
space, for example).  The JVM will also reserve, but not commit, the -Xmx size 
of the heap (and other spaces); it only commits what is really needed.

 My understanding is that RES=CODE+DATA and VIRT=RES+SWAP.

Nope.  RES is real memory usage, VIRT is just whatever space has been 
allocated, but not necessarily touched.  Until a page is touched, it won't 
exist in RAM or on the swap file.

 2. Where does the 64MB of java heap show up?

Buried inside the VIRT number.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Showing Tomcat Memory Utilization with 'top'

2010-06-22 Thread Robinson, Eric
 2. Where does the 64MB of java heap show up?

 Buried inside the VIRT number.
 
For example, I have a tomcat configured to use 96MB of heap (export
JAVA_OPTS=-ms96M -mx96M). Top shows VIRT=336396, RES=227264. I'm
guessing that the 96MB of heap is buried in BOTH the VIRT and RES
numbers?

--
Eric Robinson


Disclaimer - June 22, 2010 
This email and any files transmitted with it are confidential and intended 
solely for Tomcat Users List. If you are not the named addressee you should not 
disseminate, distribute, copy or alter this email. Any views or opinions 
presented in this email are solely those of the author and might not represent 
those of . Warning: Although  has taken reasonable precautions to ensure no 
viruses are present in this email, the company cannot accept responsibility for 
any loss or damage arising from the use of this email or attachments. 
This disclaimer was added by Policy Patrol: http://www.policypatrol.com/

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Showing Tomcat Memory Utilization with 'top'

2010-06-22 Thread Caldarale, Charles R
 From: Robinson, Eric [mailto:eric.robin...@psmnv.com]
 Subject: RE: Showing Tomcat Memory Utilization with 'top'
 
 For example, I have a tomcat configured to use 96MB of heap (export
 JAVA_OPTS=-ms96M -mx96M). Top shows VIRT=336396, RES=227264. I'm
 guessing that the 96MB of heap is buried in BOTH the VIRT and RES
 numbers?

Since -Xms == -Xmx, that is normally true.  However, the JVM may not have 
actually used all the allocated heap space, since the heap is internally 
divided into several regions (eg, eden, survivor, tenured), and some of these 
are further subdivided (TLAB).  If a page in the heap hasn't been touched (not 
unusual for some TLAB areas), it will appear in VIRT but not in RES.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Showing Tomcat Memory Utilization with 'top'

2010-06-22 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chuck,

On 6/22/2010 3:22 PM, Caldarale, Charles R wrote:
 From: Robinson, Eric [mailto:eric.robin...@psmnv.com]
 Subject: Showing Tomcat Memory Utilization with 'top'

 1. Top shows 0k of swap usage, so the system is not swapping. In that
 case, why is there a difference between the VIRT and RES numbers?
 
 Linux always allocates more virtual space than is actually used (thread stack 
 space, for example).  The JVM will also reserve, but not commit, the -Xmx 
 size of the heap (and other spaces); it only commits what is really needed.
 
 My understanding is that RES=CODE+DATA and VIRT=RES+SWAP.
 
 Nope.  RES is real memory usage, VIRT is just whatever space has been 
 allocated, but not necessarily touched.  Until a page is touched, it won't 
 exist in RAM or on the swap file.

Also, I believe VIRT includes memory shared with other processes, so if
you have 50MiB of Java system classes loaded and a modern JVM which
shares them among running JVMs, then you'll see that 50MiB included in
every process's VIRT that is sharing it, which is somewhat misleading.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwhGo0ACgkQ9CaO5/Lv0PCUlwCgmkijMJ5TQN6sMlDAboPU9upV
cQEAoI7ZWJaD1hIFsYmx89WnFRjM4dkv
=lN9a
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Showing Tomcat Memory Utilization with 'top'

2010-06-22 Thread Robinson, Eric
 Also, I believe VIRT includes memory shared with other 
 processes, so if you have 50MiB of Java system classes 
 loaded and a modern JVM which shares them among running JVMs, 
 then you'll see that 50MiB included in every process's VIRT 
 that is sharing it, which is somewhat misleading. 

Excellent point. 'top' shows 30-40MB in the 'SHR' column for each java
process. Is that what you're referring to?

--
Eric Robinson


Disclaimer - June 22, 2010 
This email and any files transmitted with it are confidential and intended 
solely for Tomcat Users List,Caldarale, Charles R. If you are not the named 
addressee you should not disseminate, distribute, copy or alter this email. Any 
views or opinions presented in this email are solely those of the author and 
might not represent those of . Warning: Although  has taken reasonable 
precautions to ensure no viruses are present in this email, the company cannot 
accept responsibility for any loss or damage arising from the use of this email 
or attachments. 
This disclaimer was added by Policy Patrol: http://www.policypatrol.com/

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Showing Tomcat Memory Utilization with 'top'

2010-06-22 Thread Caldarale, Charles R
 From: Christopher Schultz [mailto:ch...@christopherschultz.net]
 Subject: Re: Showing Tomcat Memory Utilization with 'top'
 
 Also, I believe VIRT includes memory shared with other processes

Doesn't RES also include shared pages - anything that's in the memory map of 
the process?  (I can't remember exactly how that works, but the shared pages 
have to be accounted for somewhere.)

 so if you have 50MiB of Java system classes loaded and a modern 
 JVM which shares them among running JVMs

Note that only the client HotSpot JVM shares classes; the server version does 
not.  (The sharing is really class templates, not the class objects themselves.)


 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.



RE: Showing Tomcat Memory Utilization with 'top'

2010-06-22 Thread Caldarale, Charles R
 From: Robinson, Eric [mailto:eric.robin...@psmnv.com]
 Subject: RE: Showing Tomcat Memory Utilization with 'top'
 
 'top' shows 30-40MB in the 'SHR' column for each java
 process. Is that what you're referring to?

That could be any memory (eg, file pages) that's being used in more than one 
process.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org