Skip to content

Commit

Permalink
Fix G1 GC default IHOP (#46169)
Browse files Browse the repository at this point in the history
G1 GC were setup to use an `InitiatingHeapOccupancyPercent` of 75. This
could leave used memory at a very high level for an extended duration,
triggering the real memory circuit breaker even at low activity levels.
The value is a threshold for old generation usage relative to total heap
size and thus it should leave room for the new generation. Default in
G1 is to allow up to 60 percent for new generation and this could mean that the
threshold was effectively at 135% heap usage. GC would still kick in of course and
eventually enough mixed collections would take place such that adaptive adjustment
of IHOP kicks in.

The JVM has adaptive setting of the IHOP, but this does not kick in
until it has sampled a few collections. A newly started, relatively
quiet server with primarily new generation activity could thus
experience heap above 95% frequently for a duration.

The changes here are two-fold:
1. Use 30% default for IHOP (the JVM default of 45 could still mean
105% heap usage threshold and did not fully ensure not to hit the
circuit breaker with low activity)
2. Set G1ReservePercent=25. This is used by the adaptive IHOP mechanism,
meaning old/mixed GC should kick in no later than at 75% heap. This
ensures IHOP stays compatible with the real memory circuit breaker also
after being adjusted by adaptive IHOP.
  • Loading branch information
henningandersen authored Sep 23, 2019
1 parent 2e4ca5c commit 3074bd1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion distribution/src/config/jvm.options
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
# -XX:-UseConcMarkSweepGC
# -XX:-UseCMSInitiatingOccupancyOnly
# -XX:+UseG1GC
# -XX:InitiatingHeapOccupancyPercent=75
# -XX:G1ReservePercent=25
# -XX:InitiatingHeapOccupancyPercent=30

## DNS cache policy
# cache ttl in seconds for positive DNS lookups noting that this overrides the
Expand Down

0 comments on commit 3074bd1

Please sign in to comment.