Am 23.03.2015 um 16:26 schrieb André Warnier:
Christopher Schultz wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Chuck,

On 3/23/15 10:33 AM, Caldarale, Charles R wrote:
From: Christopher Schultz [mailto:ch...@christopherschultz.net]
Subject: Re: Tomcat 7 (7.0.54) memory consuption is very high(3
times) than Tomcat 6 (6.0.28)
Really? The Tomcat ROOT web application is taking up 3 times as
much heap space in Tomcat 6 as Tomcat 7?
Just remember that the numbers out of top are at best
approximations, and, as Rainer pointed out, not taking measurements
immediately after a GC is a guarantee of an apples versus oranges
comparison.

The appropriate tools (e.g., VisualVM) must be used for any
rational analysis.

+1

The output of "top" and "ps" are completely irrelevant. The very
minimum would be the output of "jmap -heap", and only after a full GC
were to have been run.


The appropriate java-specific tools must certainly be used to find out
/what/ is using this memory inside the JVM.

But qualifying the output of "top" or "ps" as "irrelevant" is probably a
bit over the top.
After all, they do indicate how much the JVM is (approximately) using
from an OS perspective, and that is probably not totally irrelevant here.

I wanted to see the respective startup commands to check if there wasn't
some change in the default startup script switches (like -Xms/-Xmx)
which would explain the difference.
But apparently not.

Even if a GC would make the two look less different, the question would
remain as to why one Tomcat would need a GC for that, and the other not.

Interpretation of memory measurement in a system with shared libraries is non-trivial. E.g. if both measurements are not taken on the same system, and on the TC 6 system another Java process with the JVM is already running, parts of the total memory needed by Tomcat could be assigned by OS tools to the other process, because they are shared.

So I would look at OS reported sizes *and* at JVM reported sizes to get an idea, which part is atually that different.

OS reported values are e.g. using "ps": "rss", "sz" and "vsz"

Also interesting is "cat /proc/PID/maps" but here one would need to calculate sizes per line from the two hex addresses given at the start of each line. Something like:

cat /proc/PID/maps | perl -n -e '($a,$b)=split(/[- ]/);print hex($b)-hex($a), " ", $_;' | sort -n

(replace PID by the current Tomcat java process id).

JVM reported values to be taken after two times GC (the first one might be needed if the first one just runs finalizers) and then either taking it from a GC log (to be added before starting the process) or from the textual output of a thread dump (kill -QUIT) or from "jstat -gc PID". A heap dump IMHO is to cumbersome at this stage.

The gc+measurements should also probably only be done after accessing Tomcat via HTTP at least once, to increase probability of similar state of initialization.

Regards,

Rainer

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

Reply via email to