'Low maxGCPauseMillis and high initial heap size causing high number of young GCs

We have our maxGCPauseMillis as 100, and we were seeing high number of young GCs. After increasing the initial heap size to 1 GB, which was the default value earlier (~60MB), the number of such high young GC cases increased.

I could not understand why increasing the initial heap size might cause that issue to worsen. Any pointers anyone has to what might be happening here?

GC args before the change:

CommandLine flags: -XX:CICompilerCount=2 -XX:ConcGCThreads=1 
-XX:+ExitOnOutOfMemoryError -XX:G1HeapRegionSize=1048576 -XX:InitialHeapSize=60817408 -XX:MarkStackSize=4194304 
-XX:MaxGCPauseMillis=100 -XX:MaxHeapSize=968884224 
-XX:MaxNewSize=580911104 -XX:MinHeapDeltaBytes=1048576 
-XX:NumberOfGCLogFiles=5 -XX:+PrintGC -XX:+PrintGCDetails
-XX:+PrintGCTimeStamps -XX:+UseCompressedClassPointers 
-XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps 
-XX:+UseG1GC -XX:+UseGCLogFileRotation 

GC args after the change:

CommandLine flags: -XX:+ExitOnOutOfMemoryError 
-XX:InitialHeapSize=1073741824 -XX:MaxGCPauseMillis=100 
-XX:MaxHeapSize=1073741824 -XX:NumberOfGCLogFiles=5 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps 
-XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC -XX:+UseGCLogFileRotation 

Here are some gc logs pastes:



Solution 1:[1]

maxGCPauseMillis is related to GC pause during FullGC not relate to young GC or frequency of young GC. Which GC policy you are using & what are the other GC & heap parameters?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Prateek7