You can set the occupied heap rate to trigger GC’s concurrent marking phase:
-XX:InitiatingHeapOccupancyPercent=xxx, where xxx represents the max percentage of heap that can be used before marking phase starts.
To set the occupied heap rate to 40% you can use the following:
The first step for garbage collector is to identify which memory regions are in use and which are not. During this process the garbage collector scans all objects and marks them into 2 categories: referenced and unreferenced. This might be quite time-consuming since if all objects are needed to be scanned. Some of the GCs (including G1) do such a marking by a concurrent marking phase. A concurrent marking phase is started when the occupancy of the entire Java heap reaches the maximum rate value which can be set by the InitiatingHeapOccupancyPercent JVM argument. You can change the value of this parameter. A value of 0 denotes 'do constant GC cycles'.
Default value is 45
TODO link ParallelGCThreads, MaxGCPauseMillis , GCTimeRatio, MinHeapFreeRatio, MaxHeapFreeRatio, Xmx, Xms, UseSerialGC, USeParNewGC, UseParallelGC, UseZGC
If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your insights will help the entire 10+ million java developer community to develop one standard source of documentation for all the JVM arguments.