Java GC - Understanding TargetSurivorRatio

Having a problem with the GC that I cannot fix, and hope someone can give some insight. The real solution would be to add an additional JVM to accommodate the load, but this is not yet in my power.

My question is: if someone can explain the nuances -XX:TargetSurvivorRatio

From the description:

If the fine-tuning of the application has a relatively constant speed of placing objects, it is permissible to increase the load for the remaining time until the value -XX: TargetSurvivorRatio = 80 or -XX: TargetSurvivorRatio = 90 is reached. The advantage of this option helps to reduce the number of survivors needed for age objects. The task with setting -XX: TargetSurvivorRatio = above is that HotSpot VM cannot better adapt the aging process of an object when there are bursts in the distribution rates of objects, which can lead to objects of ownership earlier than you would like

The quantities in the object distribution rates are exactly what I am suffering from, as shown below: 2015-07-07T15:24:56.592-0500: 2760.113: [GC 2760.113: [ParNew Desired survivor size 483183816 bytes, new threshold 5 (max 5) - age 1: 105182048 bytes, 105182048 total - age 2: 220512 bytes, 105402560 total - age 3: 292176 bytes, 105694736 total - age 4: 303792 bytes, 105998528 total - age 5: 494584 bytes, 106493112 total : 3155059K->104104K(3670016K), 0.1605850 secs] 10036522K->6986163K(15204352K), 0.1611320 secs] [Times: user=0.29 sys=0.00, real=0.16 secs] 2015-07-07T15:25:06.838-0500: 2770.359: [GC 2770.359: [ParNew Desired survivor size 483183816 bytes, new threshold 5 (max 5) - age 1: 405021040 bytes, 405021040 total - age 2: 114464 bytes, 405135504 total - age 3: 175872 bytes, 405311376 total - age 4: 292176 bytes, 405603552 total - age 5: 302512 bytes, 405906064 total : 3249821K->398565K(3670016K), 0.1744060 secs] 10131880K->7281107K(15204352K), 0.1747200 secs] [Times: user=0.34 sys=0.00, real=0.18 secs] 2015-07-07T15:25:14.251-0500: 2777.772: [GC 2777.772: [ParNew Desired survivor size 483183816 bytes, new threshold 1 (max 5) - age 1: 536174616 bytes, 536174616 total - age 2: 202152 bytes, 536376768 total - age 3: 66784 bytes, 536443552 total - age 4: 175440 bytes, 536618992 total - age 5: 292176 bytes, 536911168 total : 3544293K->524288K(3670016K), 1.3915370 secs] 10426835K->8124824K(15204352K), 1.3919310 secs] [Times: user=2.70 sys=0.00, real=1.40 secs] 2015-07-07T15:25:24.958-0500: 2788.479: [GC 2788.479: [ParNew Desired survivor size 483183816 bytes, new threshold 5 (max 5) - age 1: 9526032 bytes, 9526032 total : 3670016K->155222K(3670016K), 0.3542590 secs] 11270552K->7846132K(15204352K), 0.3546270 secs] [Times: user=0.67 sys=0.01, real=0.36 secs] 2015-07-07T15:24:56.592-0500: 2760.113: [GC 2760.113: [ParNew Desired survivor size 483183816 bytes, new threshold 5 (max 5) - age 1: 105182048 bytes, 105182048 total - age 2: 220512 bytes, 105402560 total - age 3: 292176 bytes, 105694736 total - age 4: 303792 bytes, 105998528 total - age 5: 494584 bytes, 106493112 total : 3155059K->104104K(3670016K), 0.1605850 secs] 10036522K->6986163K(15204352K), 0.1611320 secs] [Times: user=0.29 sys=0.00, real=0.16 secs] 2015-07-07T15:25:06.838-0500: 2770.359: [GC 2770.359: [ParNew Desired survivor size 483183816 bytes, new threshold 5 (max 5) - age 1: 405021040 bytes, 405021040 total - age 2: 114464 bytes, 405135504 total - age 3: 175872 bytes, 405311376 total - age 4: 292176 bytes, 405603552 total - age 5: 302512 bytes, 405906064 total : 3249821K->398565K(3670016K), 0.1744060 secs] 10131880K->7281107K(15204352K), 0.1747200 secs] [Times: user=0.34 sys=0.00, real=0.18 secs] 2015-07-07T15:25:14.251-0500: 2777.772: [GC 2777.772: [ParNew Desired survivor size 483183816 bytes, new threshold 1 (max 5) - age 1: 536174616 bytes, 536174616 total - age 2: 202152 bytes, 536376768 total - age 3: 66784 bytes, 536443552 total - age 4: 175440 bytes, 536618992 total - age 5: 292176 bytes, 536911168 total : 3544293K->524288K(3670016K), 1.3915370 secs] 10426835K->8124824K(15204352K), 1.3919310 secs] [Times: user=2.70 sys=0.00, real=1.40 secs] 2015-07-07T15:25:24.958-0500: 2788.479: [GC 2788.479: [ParNew Desired survivor size 483183816 bytes, new threshold 5 (max 5) - age 1: 9526032 bytes, 9526032 total : 3670016K->155222K(3670016K), 0.3542590 secs] 11270552K->7846132K(15204352K), 0.3546270 secs] [Times: user=0.67 sys=0.01, real=0.36 secs]

My JAVA_OPTS look like this:

-Xms15360M -Xmx15360M -XX:MaxPermSize=512M -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:logs/gc.log -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=65 -XX:NewSize=4096M -XX:MaxNewSize=4096M -XX:SurvivorRatio=6 -XX:+PrintTenuringDistribution -XX:PermSize=512M -XX:-UseAdaptiveSizePolicy -XX:+DisableExplicitGC -XX:+ScavengeBeforeFullGC -XX:MaxTenuringThreshold=5 -XX:TargetSurvivorRatio=90

I have reduced SurvivorRatio (increasing the available Survivor Space) and increasing NewSize proportionally, but it seems that no matter what I do, my bursts are always 20-80 MB larger than my Survivor Space, and I continue to promote garbage.

Let's get back to the question at hand .. Will TargetSurvivorRatio decrease the help of my spikes? And if so, how? Would this not reduce my available Survivor Space by 50% dramatically, forcing me to advance prematurely more often? And any other contribution that you have regarding how I can survive in the first highly distributed collection will be greatly appreciated. Thanks you

UPDATE

After several hours of reading, as well as days before being published, I finally came to the conclusion about my question. TargetSurvivorRatio=90 is a good setting for my use case. To establish the memory usage for the surviving object next to TargetRatio, the JVM will dynamically select the ownership threshold (limited by MaxTenuring, of course) to achieve the desired goal.

In my case, objects more or less relate to them after 4 years and are very small. Accommodation Age: 1 - my main priority - An exceptionally large number of surviving objects that do not live up to Age. 2. I need as much space as possible for the survivors, since I already have an oversized JVM, limited space in the Old General, and there is no way to assign an extra heap. My use case is not a “surge in object allocation rates," as I thought this option was in mind ... This is just one massive surge.

If a lower target coefficient would be useful, these are scenarios in which MaxTenuringThreshold is set to a large number, and a constant number of objects are maintained throughout the path. If the number of surviving objects has increased and TargetRatio is too high, the JVM will not be able to set the Thuring Threshold to prevent premature promotion.

Regarding a general fix for my problem .. increasing the size of the survivor, decreasing the ratio and / or increasing the size of the younger generation

+7
java garbage-collection
source share

No one has answered this question yet.

See related questions:

6170
Is Java pass-by-reference or pass-by-value?
3799
How do I read / convert an InputStream to a string in Java?
3324
How to generate random integers in a specific range in Java?
3073
How to efficiently iterate over each entry on a Java map?
3044
Creating a memory leak using Java
2956
What is the difference between public, secure, batch, and private in Java?
2936
When to use LinkedList over ArrayList in Java?
2853
How to convert String to int in Java?
22
GC Tuning - Preventing Full GC
7
How does dynamic ownership threshold adjustment work in JSM HotSpot?

All Articles