Christopher Schultz wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Rainer,

On 3/25/15 6:18 AM, Rainer Jung wrote:
Am 24.03.2015 um 23:40 schrieb André Warnier:
Rainer Jung wrote:
Some numbers from a test here on RHEL 6, using Java 1.7.0_76
and TC 6.0.43, 7.0.59 and 8.0.20.

Measurement is taken directly after start (a) plus once after
one request to a non-existing page and two full GCs (b). Only
manager was deployed, not example webapps or docs. GC was run
using "jcmd PID GC.run"

Numbers from "ps"

RSSa  RSSb   SZa    SZb    VSZa    VSZb tc6 62372 68336 272952
273532 1091808 1094128 tc7 63608 70456 271710 271978 1086840
1087912 tc8 72576 79140 272257 272525 1089028 1090100

Differences between TC6 and 7 marginal, differences between tc7
and 8 only noticable in RSS, around 9MB.

Numbers from jstat -gc. First "Capacity":

Semi Spaces start with 512KB and grow to 768.0KB (TC6), 896.0KB
(tc7) and 1024.0 (tc8). Those indicate increasing allocations,
but are not relevant for total memory use.

Edena  Edenb    Olda    Oldb   Perma   Permb tc6 4288.0 6656.0
10688.0 16320.0 21248.0 21248.0 tc7 4288.0 7168.0 10688.0
17904.0 21248.0 21248.0 tc8 6144.0 8640.0 15316.0 21316.0
21248.0 21248.0

Again this is capacity so including garbage and unused. We see
that Perm is unchanged. For all versions Eden grows by 2.4-2.9
MB due to allocation activity. Numbers for tc6 and 7 are again
very similar, tc8 numbers are slightly higher already after
startup. Old (Tenured) grows by about 6-7MB, again very similar
for tc 6 and tc 7 and slightly higher for TC 8.

Now for the used numbers after GC, which are more relevant
(allocation rates are another topic):

Edena  Edenb    Olda    Oldb   Perma   Permb tc6 2910.8   69.3
7231.7  7984.1 13923.0 14429.1 tc7 2326.1   73.8  8504.4
9661.2 13910.1 15340.1 tc8  203.7   60.9 10577.6 12599.7
16183.3 17653.8

So the live objects are Edenb+Oldb:

Edenb+Oldb tc6  8053.4 tc7  9735.0 tc8 12660.6

And here we see some increase but the total amount of about
2MB between tc 6 and 7 and about another 3 MB between 7 and 8
seems to be not really problematic. The same holds true for
perm, there's an increase of about 1MB between 6 and 7 and 2 MB
between 7 and 8.

Finally: where does the difference between RSS, Sz and the sum
of heap and eden come from?

Example for TC 8 case b:

RSS: 79140 SZ: 272525

Sum of RSS due to "smaps": 79088 so roughly consistent.

S0+S1+E+O+P capacity: 53252, but Rss 40872, so a delta of 38MB
to RSS.

smaps entries that can be identified:

Type        Size   Rss Perm       21248 17656 Old        21316
15040 Eden+S0+S1 10688  8176 libjvm.so  11732  7712
(read-only)

Then about 21 thread stack reservations, total Size 21676,
total Rss 2804.

So the delta goes down to 38 - 7.7 - 2.8 = 28MB.

Some more segments, that I can't fully interprete are:

Size  Rss    from     -    to       Perm File 8852 7648
7f2818000000-7f28188a5000 rw-p 8940 6496
7f2814000000-7f28148bb000 rw-p 51116 4064
7f2835270000-7f283845b000 rw-p 2496 2048
7f2835000000-7f2835270000 rwxp 1788 1732
7f283d443000-7f283d602000 r--s .../lib/rt.jar 3304 1444
7f282c000000-7f282c33a000 rw-p 784 784
7f283f1d9000-7f283f29d000 rw-p .../lib/amd64/server/libjvm.so 1564 648 3f6d200000-3f6d387000 r-xp /lib64/libc-2.12.so 536 524
7f2830000000-7f2830086000 rw-p 272 208
7f283f29d000-7f283f2e1000 rw-p

and those nearly make up the "missing" 28MB Rss (whatever they
are).
...

But now, for the mere humans among us, what does it mean in terms
of the OP and his original question : why does Tomcat 7 seem to
be using 70 MB more memory at startup than Tomcat 6 ? Is it : -
it doesn't matter. The numbers shown are wrong, and if you run
10 instances of Tomcat 7 at the same time, you will see that they
are not really using 700 MB more than before. or - it is normal
and expected. Tomcat 7 - because of the new Servlet Spec - needs
to borogrove the watchamecalits, and this is using 70 MB more heap than before. In return, you get a 25% performance
improvement later.. or - we have no clue. It does not happen on
other machines, so there must be something special on your
machine, and to find out what we need heap dumps. or - obviously
some cleverer and definitive answer derived from Rainer's exhaustive analysis abobe, and which is ? ................

From the above analysis, I get the impression that there is only
really a couple of MB additional memory used as one goes from
Tomcat 6 to Tomcat 7 and then to Tomcat 8.
Yes. Things might change if a real app comes into play. But again
I would not expect big differences if it is an app that only uses
old features, e.g. runs in old and new TC versions unchanged.

The OP reported that be was using Tomcat's "examples" application.

Actually I believe he said that there was only the standard ROOT application.
That is only static pages, isn't it ?

Presumably, he was using the appropriate "examples" application for
each of the two Tomcats and not the same one in both.


Anyway, to cut to the bone : the one thing clearly established by Rainer is that, with a standard Tomcat 6 and a standard Tomcat 7 downloaded from the Tomcat ASF website, the difference in memory usage between an idle and stabilised Tomcat 6 and an idle and stabilised Tomcat 7 is, at the very most, about 10 MB.
And it is definitely not the 70 MB which top (or ps) seems to show on the OP's 
system.
So that hints to the fact that the 70 MB difference reported by the OP is due to something local on the OP's system (or his measurement conditions), and is not a fundamental built-in difference between Tomcat 6 and Tomcat 7.

And it is true that this was the general opinion of the experts from the start, but until Rainer's exercise there were no numbers to back up that opinion, and now there are.


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

Reply via email to