Frequent full gc troubleshooting steps, ask for advice ~

for example, if the machine full gc seven or eight times at regular intervals in an afternoon, how to start to query the problem? I feel that I can"t see anything when I look at the jstack log. Mengxin asks for help.

Jvm
Mar.01,2021

1. Save thread stack: jstack-l pid > jstack.log
2, save heap:jmap-dump:format=b,file=heap.hprof pid
3, use mat to analyze heap, to see if there are memory leaks
4, analyze gc log (if gc log, is not opened before, then reopen it, and then check it with gc log) to see if the gc parameter configuration is not appropriate

.

add the parameter to enable gclog

  • java8 and previous versions
-XX:+PrintGCDetails 
-XX:+PrintGCDateStamps 
-XX:+PrintGCTimeStamps
-XX:+PrintTenuringDistribution 
-Xloggc:/some-path/gc-$(date +%Y%m%d-%H%M%S).log
-XX:+UseGCLogFileRotation
-XX:NumberOfGCLogFiles=5
-XX:GCLogFileSize=10M
  • java9 and above
-Xlog:gc*=info:file=/some-path/gc-%t-%p.log:timemillis,pid:filecount=5,filesize=10M

jdk8 adds this parameter, but no gc log

Menu