Important G1 GC arguments

For tuning purposes, in the below table, we have summarized important G1 GC algorithm arguments and their default values:

G1 GC argument Description
-XX:MaxGCPauseMillis=200 Sets a maximum pause time value. The default value is 200 milliseconds.
-XX:G1HeapRegionSize=n Sets the size of a G1 region. The value has to be power of two i.e. 256, 512, 1024,.. It can range from 1MB to 32MB.
-XX:GCTimeRatio=12 Sets the total target time that should be spent on GC vs total time to be spent on processing customer transactions. The actual formula for determining the target GC time is [1 / (1 + GCTimeRatio)]. Default value 12 indicates target GC time to be [1 / (1 + 12)] i.e. 7.69%. It means JVM can spend 7.69% of its time in GC activity and remaining 92.3% should be spent in processing customer activity.
-XX:ParallelGCThreads=n Sets the number of the Stop-the-world worker threads. If there are less than or equal to 8 logical processors then sets the value of n to the number of logical processors. Say if your server 5 logical processors then sets n to 5. If there are more than eight logical processors, set the value of n to approximately 5/8 of the logical processors. This works in most cases except for larger SPARC systems where the value of n can be approximately 5/16 of the logical processors.
-XX:ConcGCThreads=n Sets the number of parallel marking threads. Sets n to approximately 1/4 of the number of parallel garbage collection threads (ParallelGCThreads).
-XX:InitiatingHeapOccupancyPercent=45 GC marking cycles are triggered when heap's usage goes beyond this percentage. The default value is 45%.
-XX:G1NewSizePercent=5 Sets the percentage of the heap to use as the minimum for the young generation size. The default value is 5 percent of your Java heap.
-XX:G1MaxNewSizePercent=60 Sets the percentage of the heap size to use as the maximum for young generation size. The default value is 60 percent of your Java heap.
-XX:G1OldCSetRegionThresholdPercent=10 Sets an upper limit on the number of old regions to be collected during a mixed garbage collection cycle. The default is 10 percent of the Java heap.
-XX:G1ReservePercent=10 Sets the percentage of reserve memory to keep free. The default is 10 percent. G1 Garbage collectors will try to keep 10% of the heap to be free always.