jstat -classHowever, there are other metadata or implementation overhead (i.e., MetaBlock overhead) not accounted for in the reported sizes.
In this article, we will introduce another way of monitoring the sizes needed for "Metaspace" and "Class Space".
Heap Statistics Reported by PrintGC
As described in [2], the following heap statistics would be printed at the exit of JVM if you have enabled PringGC (i.e., PrintGCDetails or PrintHeapAtGC):
Heap
garbage-first heap total 2097152K, used 1680819K [0x0000000080000000, 0x0000000100000000, 0x0000000100000000)
region size 4096K, 27 young (110592K), 9 survivors (36864K)
Metaspace used 327768K, capacity 340303K, committed 340780K, reserved 1349632K
class space used 37537K, capacity 40670K, committed 40832K, reserved 1048576K
jstat -gc Command
jstat -gc can be used to display Garbage-collected heap statistics. In JDK 8, it would display Metaspace's statistics, but not PermGen's.
-bash-3.2$ jstat -gc 18990 1000 3
Warning: Unresolved Symbol: sun.gc.generation.2.space.0.capacity substituted NaN
Warning: Unresolved Symbol: sun.gc.generation.2.space.0.used substituted NaN
S0C S1C S0U S1U EC EU OC OU PC PU
0.0 16384.0 0.0 16384.0 94208.0 12288.0 1986560.0 1783935.8 � �
0.0 16384.0 0.0 16384.0 94208.0 57344.0 1986560.0 1775743.8 � �
0.0 16384.0 0.0 16384.0 94208.0 69632.0 1986560.0 1775743.8 � �
At the first try, it has printed the above three lines. However, the default jstat was run, which belongs to JDK 7. So, you still see headers such as "PC" and "PU". Also, you could see some gibberish text because of "unresolved symbols." To run jstat, you need to use the correct version (i.e., from your JDK 8 installation). After correcting this error, we have seen:
-bash-3.2$ cd JVMs/
-bash-3.2$ jdk-hs/bin/jstat -gc 18990 1000 3
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU
0.0 28672.0 0.0 28672.0 163840.0 45056.0 1904640.0 1663244.2 340992.0 327753.1 40960.0 37549.0
0.0 28672.0 0.0 28672.0 163840.0 77824.0 1904640.0 1663244.2 340992.0 327753.1 40960.0 37549.0
0.0 28672.0 0.0 28672.0 163840.0 86016.0 1904640.0 1663244.2 340992.0 327753.1 40960.0 37549.0
Note that we now see "MC", "MU", "CCSC", and "CCSU" instead of "PC" and "PU".
Meaning of "MC", "MU", "CCSC", and "CCSU"
There is no good documentation on what they mean yet. But, a good guess would be:
- MC (Metaspace Committed)
- MU (Metaspace Used)
- CCSC (Compressed Class Space Committed)
- CCSU (Compressed Class Space Used)
If you check the values printed out from "jstat -gc" and the values printed out at JVM's exit time. They have similar values. Note that the "jstat -gc" command was issued close to the end of our JVM run.
To learn more about these new headers, read [2].
Acknowledgement
Some writings here are based on the feedback from Jon Masamitsu. However, the author would assume the full responsibility for the content himself.
No comments:
Post a Comment