metaSpace cause full gc investigation process

JDK8 with metaSpace regions instead of the previous permanent zone, the region's main storage class information is loaded, my hands every time you start a project, when will be accompanied by a fullgc, troubleshooting ideas:

First, view memory usage

Command: jstat -gcutil PID, PID here is that Java process ID

You can see the old year utilization rate is only 1.96%, but usage is 96.13% MetaSpace area, initially suspected to be metaSpace area set too small.

 

Second, view the log gc (JVM parameters where you can configure the print gc information)

CMS garbage project payback period to recover the use of the old year, CMS garbage payback in fullgc steps can be divided into:

Initial labels (the STW) -> concurrent mark -> Concurrent precleaning -> marking (the STW) -> Concurrent cleaning -> Reset, the screenshot is mapped to a full fullGC process, following analysis of the log:

1 is a position marker [ParNew: 218582K-> 15126K (235968K), 0.0166181 secs], the phrase means that the new generation garbage collection occupied before 218582K, recovered occupied 15126K, the total capacity of 235968K, 0.0166181 consuming, which is a normal the minor gc

Information mark 2 is very suspicious, 218582K-> 15126K (1022400K), meaning that the entire sentence before the gc heap occupancy 218582K, recovered 15126K, the total size of 1022400K, that is to say when the amount of about 20% appeared fullgc local mark 3 also illustrates the use of the entire stack is very low.

Gc information from the log is similar, and heap it does not matter.

 

A condition known to trigger fullgc are:

Old's space - excluded

With a lack of permanent space, which is jdk8 in metaSpace area

CMS emergence promotion failed and concurrent mode failure at the time gc

promotion failed means that when the new generation of objects promoted to the old era, triggering fullgc's old space is insufficient, this can be ruled out

concurrent mode failure 是指CMS在进行老年代垃圾回收时,由于CMS在gc时为了减少STW停顿时间,采用用户线程和垃圾回收线程并行执行的方式,所以此时用户线程还是会产生内存对象,这些对象就是浮动对象,如果此时有浮动对象晋升到老年代,而老年代空间不足时,就会触发concurrent mode failure,导致JVM不得不停止用户线程来进行fullgc,这时候就会STW,而我这边的老年代空间充足,可以排除。

 

这样基本可以确定是metaSpace问题

 

任何一个JVM参数的默认值可以通过java -XX:+PrintFlagsFinal -version |grep JVMParamName获取,例如:java -XX:+PrintFlagsFinal -version |grep MetaspaceSize

发布了19 篇原创文章 · 获赞 3 · 访问量 9583

Guess you like

Origin blog.csdn.net/pinghuqiuyue9/article/details/103964954