How does JVM decide the tenuringThreshold?

Jun Zhuang jun.zhuang at hobsons.com
Wed Dec 16 21:52:09 UTC 2015


Hi,

I am trying to gain some knowledge regarding how GC works by running load tests against a java web service, hosted on JBOSS, and adjusting various java startup parameters. One interesting thing I noticed was the tenuring threshold, I thought it would change with size of the survivor space, but I could never make it happen, can someone provide some clue? Following is what I did:

JAVA startup parameters:
-Xms2g -Xmx2g -XX:MaxPermSize=256m -XX:NewSize=128m -XX:MaxNewSize=128m -XX:SurvivorRatio=126

I then changed the SurvivorRatio to 30, 6, and 1, but the "new threshold" in the GC log always stayed at 1 after the first few young GCs, adding -XX:TargetSurvivorRatio=90 did not seem to make any difference:

4.504: [GC
Desired survivor size 16777216 bytes, new threshold 7 (max 15)
 [PSYoungGen: 98304K->7553K(114688K)] 98304K->7553K(2080768K), 0.0199500 secs] [Times: user=0.04 sys=0.01, real=0.02 secs]
12.784: [GC
Desired survivor size 16777216 bytes, new threshold 7 (max 15)
 [PSYoungGen: 105857K->8979K(114688K)] 105857K->8979K(2080768K), 0.0177280 secs] [Times: user=0.04 sys=0.01, real=0.01 secs]
18.935: [GC
Desired survivor size 16777216 bytes, new threshold 7 (max 15)
 [PSYoungGen: 107283K->13322K(114688K)] 107283K->13322K(2080768K), 0.0282660 secs] [Times: user=0.06 sys=0.00, real=0.02 secs]
22.944: [GC
Desired survivor size 16777216 bytes, new threshold 7 (max 15)
 [PSYoungGen: 111626K->11304K(114688K)] 111626K->11377K(2080768K), 0.0255770 secs] [Times: user=0.08 sys=0.00, real=0.03 secs]
24.089: [GC
Desired survivor size 16777216 bytes, new threshold 6 (max 15)
 [PSYoungGen: 109608K->16377K(114688K)] 109681K->17678K(2080768K), 0.0373650 secs] [Times: user=0.10 sys=0.01, real=0.04 secs]
24.801: [GC
Desired survivor size 16777216 bytes, new threshold 5 (max 15)
 [PSYoungGen: 114681K->16358K(114688K)] 115982K->21621K(2080768K), 0.0627800 secs] [Times: user=0.21 sys=0.01, real=0.06 secs]
25.500: [GC
Desired survivor size 16777216 bytes, new threshold 4 (max 15)
 [PSYoungGen: 114662K->16359K(114688K)] 119925K->30181K(2080768K), 0.0577540 secs] [Times: user=0.17 sys=0.01, real=0.06 secs]
26.280: [GC
Desired survivor size 16777216 bytes, new threshold 3 (max 15)
 [PSYoungGen: 114663K->16354K(114688K)] 128485K->37506K(2080768K), 0.0539360 secs] [Times: user=0.15 sys=0.01, real=0.05 secs]
27.330: [GC
Desired survivor size 16777216 bytes, new threshold 2 (max 15)
 [PSYoungGen: 114658K->14928K(114688K)] 135810K->42581K(2080768K), 0.0588730 secs] [Times: user=0.20 sys=0.01, real=0.06 secs]
28.108: [GC
Desired survivor size 16777216 bytes, new threshold 1 (max 15)
 [PSYoungGen: 113232K->16363K(114688K)] 140972K->59269K(2080768K), 0.0586460 secs] [Times: user=0.15 sys=0.01, real=0.06 secs]
. . .
1538.726: [GC
Desired survivor size 3932160 bytes, new threshold 1 (max 15)
 [PSYoungGen: 129280K->1792K(125184K)] 433305K->308417K(2091264K), 0.2403020 secs] [Times: user=0.83 sys=0.01, real=0.24 secs]
1543.537: [GC
Desired survivor size 4063232 bytes, new threshold 1 (max 15)
 [PSYoungGen: 125184K->2592K(126016K)] 431809K->310233K(2092096K), 0.2318620 secs] [Times: user=0.83 sys=0.01, real=0.23 secs]
1548.268: [GC
Desired survivor size 3932160 bytes, new threshold 1 (max 15)
 [PSYoungGen: 125984K->1344K(127232K)] 433625K->310657K(2093312K), 0.2294920 secs] [Times: user=0.83 sys=0.01, real=0.23 secs]


If the threshold is really 1, then nothing should be promoted to the old gen, but that definitely was not the case.

-------------------------------------------------------------------------------------------------------

I also experimented with -XX:-UsePSAdaptiveSurvivorSizePolicy, the "new threshold" always stays at 7 despite the SurvivorRatio value.

1643.408: [GC
Desired survivor size 4194304 bytes, new threshold 7 (max 15)
 [PSYoungGen: 519729K->4032K(520192K)] 935797K->420443K(2093056K), 0.2605620 secs] [Times: user=0.94 sys=0.01, real=0.26 secs]
1662.092: [GC
Desired survivor size 4194304 bytes, new threshold 7 (max 15)
 [PSYoungGen: 520128K->4096K(520192K)] 936539K->421235K(2093056K), 0.2588890 secs] [Times: user=0.95 sys=0.01, real=0.26 secs]
1680.882: [GC
Desired survivor size 4194304 bytes, new threshold 7 (max 15)
 [PSYoungGen: 520192K->4096K(520192K)] 937331K->422347K(2093056K), 0.2661180 secs] [Times: user=0.97 sys=0.00, real=0.27 secs]
1698.975: [GC
Desired survivor size 4194304 bytes, new threshold 7 (max 15)
 [PSYoungGen: 520192K->4096K(520192K)] 938443K->423246K(2093056K), 0.2626090 secs] [Times: user=0.95 sys=0.01, real=0.26 secs]


Appreciate any input,
Jun

Jun Zhuang
Sr. Performance QA Engineer | Hobsons

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-gc-use/attachments/20151216/083ebe94/attachment-0001.html>


More information about the hotspot-gc-use mailing list