Having recently attempted to increase the heap space and ratio of new to old gen size I'm seeing confusing results from jstat -gccapacity
which is showing much smaller capacities than I would expect.
The JVM (1.5.0_16) is started with -server -Xms2048m -Xmx2048m -XX:NewRatio=2
. It's running on a Solaris 5.10 amd64 host. With about 10GB of free memory. So from what I've read the JVM should be able to make use of the full 2GB of heap space.
Watching jstat -gcutil
I've observed all of the generations filling up several times causing garbage collections. E.g.:
Timestamp S0 S1 E O P YGC YGCT FGC FGCT GCT
66150.4 0.00 51.09 56.95 90.33 54.85 6291 58.922 7 22.826 81.748
Which I would have thought would cause the JVM to expand all the generations to their full size. However, jstat -gccapacity
produces:
NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC PGCMN PGCMX PGC PC YGC FGC
700416.0 700416.0 86016.0 1408.0 1408.0 39104.0 1398784.0 1398784.0 1398784.0 1398784.0 16384.0 65536.0 38912.0 38912.0 6338 7
Subsequent runs show NGC/S0C/S1C/EC change in value:
NGCMN NGCMX NGC S0C S1C EC OGCMN OGCMX OGC OC PGCMN PGCMX PGC PC YGC FGC
700416.0 700416.0 86016.0 1472.0 1472.0 39104.0 1398784.0 1398784.0 1398784.0 1398784.0 16384.0 65536.0 38912.0 38912.0 6380 7
700416.0 700416.0 106496.0 1792.0 1856.0 97024.0 1398784.0 1398784.0 1398784.0 1398784.0 16384.0 65536.0 38912.0 38912.0 6433 7
700416.0 700416.0 106496.0 1792.0 1792.0 96064.0 1398784.0 1398784.0 1398784.0 1398784.0 16384.0 65536.0 38912.0 38912.0 6436 7
From what I understand, the capacity figures are the total size of the generation and the utilisation figures show allocations within the generation. So the above result is telling me that the combined new gen min and max capacities are both (NGCMN/MGCMX) 684MB and the old gen min and max are 1,366MB (OGCMN/OGCMX). What's confusing me is the capacities of the new generations. So my questions:
- Why doesn't EC + S0C + S1C == NGC? (41,920 != 86016)
- Why is NGC significantly smaller than NGCMN/MGCMX?
- Is this because the max heap size is being hit (which would put it at 1,488MB, from NGC+OGC+PGC), if so what would cause the lower limit? All the documentation I can find says a Solaris 64 bit JVM should be able to use 4GB.
- If the max heap size is being hit why do the new generations change in capacity (either all increasing or all decreasing) without the older generation changing to compensate).
Other potentially useful jstat results:
$ jstat -gcnew 20167
S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT
1536.0 1600.0 1300.3 0.0 13 15 1600.0 82880.0 30892.6 6482 60.540
$ jstat -gcnewcapacity 20167
NGCMN NGCMX NGC S0CMX S0C S1CMX S1C ECMX EC YGC FGC
700416.0 700416.0 106496.0 1472.0 233472.0 233472.0 1408.0 700288.0 81088.0 6489 7
$ jstat -gcold 20167
PC PU OC OU YGC FGC FGCT GCT
38912.0 21426.5 1398784.0 1375651.6 6503 7 22.826 83.627
$ jstat -gcoldcapacity 20167
OGCMN OGCMX OGC OC YGC FGC FGCT GCT
1398784.0 1398784.0 1398784.0 1398784.0 6517 7 22.826 83.779
$ jstat -gcpermcapacity 20167
PGCMN PGCMX PGC PC YGC FGC FGCT GCT
16384.0 65536.0 38912.0 38912.0 6531 7 22.826 83.925