How to optimize pause time G1

My JAVA_OPTS

-server -Xms4g -Xmx4g -XX:MaxMetaspaceSize=384m -Xmn2g -Xloggc:/home/admin/logs/gc.log 
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseG1GC -XX:MaxGCPauseMillis=300

I am satisfied with the Full GC frequency, and the time span between the two GCs is 5 hours or longer. One of the magazines Full GCs:

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 G1 Stop The World ? If so, the pause time is more than 1 second, which is unacceptable. How to optimize?

+4
source share
1 answer

-Xmn2gis in conflict with -XX:MaxGCPauseMillis=300.

G1 will dynamically adjust the size of the new generation.

You should just delete -Xmn2g.

+1
source

Source: https://habr.com/ru/post/1662233/


All Articles