问题
I'm using the G1 garbage collector.
You can enable adaptive size policy logs with
-XX:+PrintAdaptiveSizePolicy
Here's sample output in the GC logs
1822.780: [G1Ergonomics (Heap Sizing) attempt heap expansion, reason: recent GC overhead higher than threshold after GC, recent GC overhead: 11.48 %, threshold: 10.00 %, uncommitted: 0 bytes, calculated expansion amount: 0 bytes (20.00 %)]
Which JVM flag manages the threshold: 10.00 % that is mentioned in there?
Below are some of the flags that seemed related, but I tried setting a different value for a few of them and the log message didn't change.
user@host:/home/logs/cassandra$ java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version | egrep "Threshold|Percent|Ratio"
intx BackEdgeThreshold = 100000 {pd product}
intx BiasedLockingBulkRebiasThreshold = 20 {product}
intx BiasedLockingBulkRevokeThreshold = 40 {product}
intx BlockLayoutMinDiamondPercentage = 20 {C2 product}
uintx CMSIsTooFullPercentage = 98 {product}
double CMSLargeCoalSurplusPercent = 0.950000 {product}
double CMSLargeSplitSurplusPercent = 1.000000 {product}
uintx CMSPrecleanThreshold = 1000 {product}
uintx CMSScheduleRemarkEdenSizeThreshold = 2097152 {product}
uintx CMSScheduleRemarkSamplingRatio = 5 {product}
double CMSSmallCoalSurplusPercent = 1.050000 {product}
double CMSSmallSplitSurplusPercent = 1.100000 {product}
uintx CMSTriggerRatio = 80 {product}
uintx CMSWorkQueueDrainThreshold = 10 {product}
uintx CMS_SweepTimerThresholdMillis = 10 {product}
intx CompileThreshold = 10000 {pd product}
intx G1ConcRefinementThresholdStep = 0 {product}
uintx G1ConfidencePercent = 50 {product}
uintx G1HeapWastePercent = 5 {product}
intx G1RSetUpdatingPauseTimePercent = 10 {product}
uintx G1ReservePercent = 10 {product}
uintx G1SATBBufferEnqueueingThresholdPercent = 60 {product}
uintx GCLockerEdenExpansionPercent = 5 {product}
uintx GCTimeRatio = 99 {product}
uintx IncreaseFirstTierCompileThresholdAt = 50 {product}
uintx InitialSurvivorRatio = 8 {product}
uintx InitialTenuringThreshold = 7 {product}
uintx InitiatingHeapOccupancyPercent = 45 {product}
intx InterpreterProfilePercentage = 33 {product}
uintx LargePageHeapSizeThreshold = 134217728 {product}
uintx MarkSweepDeadRatio = 1 {product}
uintx MaxHeapFreeRatio = 100 {manageable}
uintx MaxMetaspaceFreeRatio = 70 {product}
uintx MaxTenuringThreshold = 15 {product}
uintx MinHeapFreeRatio = 0 {manageable}
intx MinInliningThreshold = 250 {product}
uintx MinMetaspaceFreeRatio = 40 {product}
uintx MinSurvivorRatio = 3 {product}
uintx NewRatio = 2 {product}
intx OnStackReplacePercentage = 140 {pd product}
uintx PretenureSizeThreshold = 0 {product}
intx ProfileMaturityPercentage = 20 {product}
uintx StringDeduplicationAgeThreshold = 3 {product}
uintx SurvivorRatio = 8 {product}
uintx TLABWasteTargetPercent = 1 {product}
uintx TargetSurvivorRatio = 50 {product}
uintx ThresholdTolerance = 10 {product}
intx Tier0ProfilingStartPercentage = 200 {product}
intx Tier2BackEdgeThreshold = 0 {product}
intx Tier2CompileThreshold = 0 {product}
intx Tier3BackEdgeThreshold = 60000 {product}
intx Tier3CompileThreshold = 2000 {product}
intx Tier3InvocationThreshold = 200 {product}
intx Tier3MinInvocationThreshold = 100 {product}
intx Tier4BackEdgeThreshold = 40000 {product}
intx Tier4CompileThreshold = 15000 {product}
intx Tier4InvocationThreshold = 5000 {product}
intx Tier4MinInvocationThreshold = 600 {product}
intx TypeProfileMajorReceiverPercent = 90 {C2 product}
java version "1.8.0_72"
Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)
回答1:
GCTimeRatio
is the one you're looking for, it has a different default when you actually specify G1. In general PringFlagsFinal
should be appended to your actual command line because some flags can influence the defaults of others.
What drives the GC ergonomics is covered in the official docs, you should read them before embarking on GC tuning.
来源:https://stackoverflow.com/questions/36189138/which-jvm-flag-sets-the-gc-overhead-threshold-mentioned-in-the-g1ergonomics-log