JDK-8227719 : G1 Pending cards estimation too conservative in cost prediction
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 14
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-07-16
  • Updated: 2019-08-23
  • Resolved: 2019-07-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 14
14 b07Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Description
In several places G1 tries to predict the time processing of the cards in the DCQS takes, particularly at the start of GC to determine the initial collection set, but also at the end of the GC to determine the eden length.

This time is basically determined by the formula:

  pending_cards_at_gc_start * cost_per_pending_card_during_gc

The problem is that the cost_per_pending_card_during_gc is determined on the actual processed cards during GC (starting with JDK-8213108); and pending_cards_at_gc_start is determined by

  sum(cards_in_thread_buffers) + num_completed_buffers * buffer_size

This can be a fairly inflated number in some applications, as we filter DCQS queues for unneeded elements.

Applications show a 3-4x higher "pending cards" than what is printed in "Scanned Cards" in many cases.

This seems to cause the prediction for the time to process cards being way too high, causing G1 to use a smaller young gen than necessary and not being close to pause time at all.

E.g. GCBasher with 256m heap with a 15ms target pause time that in situations of fairly constant load generally uses only around 10ms. (and not giving it any pause target gives around 15ms avg)

Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/f6b30bd6804e User: tschatzl Date: 2019-07-24 09:49:55 +0000
24-07-2019

Statistics running gcbasher for 180s at 256M heap with 15ms pause time goal shows significant improvements on reaching the pause time goal (~10.5ms avg up to 11.6ms avg); decreases number of GCs by ~13% with the change.
18-07-2019

The exact number of pending cards can be determined by hooking into the DCQS enqueuing/dequeuing code.
18-07-2019

Interestingly we do already have a pending card predictor.
16-07-2019