My JAVA_OPTS is
-server -Xms4g -Xmx4g -XX:MaxMetaspaceSize=384m -Xmn2g -Xloggc:/home/admin/logs/gc.log
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseG1GC -XX:MaxGCPauseMillis=300
I'm satisfied with the frequency of Full GC,and the timespan between two GCs is 5 hours or longer. One of Full GCs' log is:
2016-11-29T03:59:18.009+0800: 385603.123: [Full GC (Allocation Failure) 4066M->1197M(4096M), 2.5124454 secs]
[Eden: 0.0B(2048.0M)->0.0B(2048.0M) Survivors: 0.0B->0.0B Heap: 4066.4M(4096.0M)->1197.1M(4096.0M)], [Metaspace: 168228K->167780K(1206272K)]
[Times: user=3.24 sys=0.00, real=2.52 secs]
Is the Full GC of G1 Stop The World ? If so,the pause time is longer than 1 second,which is unacceptable.How to optimize ?