How does dynamic ownership threshold adjustment work in JSM HotSpot?

So far I know that:

  • Objects stand out in the eden space , and if they survive from a small collection, they get promotion to one of the surviving places
  • For further small objects, collections that survive in small collections are exchanged between the two survivors. During these objects, individual ages increase with each small collection.
  • Objects that reach a certain threshold get promotion into the occupied space (old generation).
  • You can set InitialTenuringThreshold (since it says it is β€œinitial”, not β€œmin”) and MaxTenuringThreshold (MaxValue: 15). However, the JVM adjusts the threshold value of the actual (I think, every time after a large collection) regarding the actual space used for the survivors and the desired survivor .
  • The required space can be changed using the JVM parameter " TargetSurvivorRatio " and defaults to 50% of the maximum number of survivors.

My questions:

  • Regarding what exactly jvm corrects the actual tenurig threshold.
  • What happens to all object age queues after changing the jvm of the actual ownership threshold. Such as:
    • timeStamp1 : The current actual ownership that jvm has installed is 15. At each age, objects are distributed.
    • timeStamp2 : jvm adjusted the actual ownership threshold to 5. What happens now with all objects with age n> 5 from timeStamp1 ?

No documentation was found on this issue.

+7
java garbage-collection jvm heap-memory jvm-hotspot
source share
1 answer

I am very far from the JDK codebase expert, but I believe most of your answers will be around the classes that I mention. I guess from a quick reading and am very happy to hear corrections.

Question 1:

According to http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/87ee5ee27509/src/share/vm/gc_implementation/shared/ageTable.cpp L81 and next (compute_tenuring_threshold), the JVM will iterate over each age and add size of objects with this age, As soon as he exceeds the desired_survivor_size, he will stop and accept the last age that he received as a new candidate threshold. The selected new threshold is min (candidAge, MaxTenuringThreshold)

compute_tenuring_threshold is called in G1 from http://hg.openjdk.java.net/jdk8/jdk8/hotspot/file/87ee5ee27509/src/share/vm/gc_implementation/shared/g1CollectorPolicy.cpp which interrupts _max_surviviv SurvivorRatio), then calls the compute_ .. method above.

The file young_list_target_length is updated in the g1CollectorPolicy.hpp file:

587 // Update the young list target length either by setting it to the 588 // desired fixed value or by calculating it using G1 pause 589 // prediction model. If no rs_lengths parameter is passed, predict 590 // the RS lengths using the prediction model, otherwise use the 591 // given rs_lengths as the prediction. 592 void update_young_list_target_length(size_t rs_lengths = (size_t) -1); 

I did not look into the model, but I think this will answer your question: threshold changes are triggered after fewer ages are reached to save the desired_survivor_size (which AFAIK is explained here http://www.oracle.com/technetwork/ java / javase / tech / vmoptions-jsp-140102.html ). The new threshold is selected based on the given / predicted RS lengths.

Question 2:

Check this out at g1CollectorPolicy.cpp, right at the start of a new collection pause:

 839 // We only need to do this here as the policy will only be applied 840 // to the GC we're about to start. so, no point is calculating this 841 // every time we calculate / recalculate the target young length. 842 update_survivors_policy(); 

I understand that the threshold will thus be updated before the GC starts. If this case when living objects are visited in the regions of the survivors, all objects that have object.age> newAge will be taxed (including those that had an age <threshold in timestamp1 but now exceed it).

Hope this makes a little sense.

0
source share

All Articles