为什么FGC在终身产生时占50%而且元空间占98%

时间:2017-02-09 09:59:07

标签: java garbage-collection metaspace

JVM版本
java版本" 1.8.0_111"
Java(TM)SE运行时环境(版本1.8.0_111-b14)
Java HotSpot(TM)64位服务器VM(版本25.111-b14,混合模式)
JVM内存使用情况如:

 def新一代总计33216K,使用4K [0x00000000fa000000,0x00000000fc400000,0x00000000fc400000)
  伊甸园空间29568K,0%使用[0x00000000fa000000,0x00000000fa001080,0x00000000fbce0000)
  从空间3648K,0%使用[0x00000000fc070000,0x00000000fc070000,0x00000000fc400000)
  空间3648K,0%使用[0x00000000fbce0000,0x00000000fbce0000,0x00000000fc070000)
 终身代总计61440K,使用34490K [0x00000000fc400000,0x0000000100000000,0x0000000100000000)
   空间61440K,56%使用[0x00000000fc400000,0x00000000fe5aeaa8,0x00000000fe5aec00,0x0000000100000000)
 Metaspace使用51022K,容量51693K,承诺57344K,保留57344K

JVM args是:
JAVA_OPTS =" $ JAVA_OPTS" -server" " -XX:+ UseSerialGC" " -XX:+ UseAdaptiveSizePolicy
JAVA_OPTS =" $ JAVA_OPTS" -Dcom.sun.management.jmxremote.port = 31345" " -Djava.rmi.server.hostname = 0.0.0.0" " -Dcom.sun.management.jmxremote.authenticate =假" " -Dcom.sun.management.jmxremote.ssl =假" " -Dcom.sun.management.jmxremote.ssl.need.client.auth =假" " -XX:+ UnlockCommercialFeatures" " -XX:+ FlightRecorder
JAVA_OPTS =" $ JAVA_OPTS" -XX:-UseCompressedClassPointers
JAVA_OPTS =" $ JAVA_OPTS" -XX:MaxMetaspaceSize = 56m" " -XX:MarkStackSize = 32768" " -XX:MarkStackSizeMax = 4194304" " -XX:SharedReadWriteSize = 12582912" " -XX:StackShadowPages = 3" " -XX:VMThreadStackSize = 512
JAVA_OPTS =" $ JAVA_OPTS" -XX:InitialCodeCacheSize = 48m" " -XX:ReservedCodeCacheSize =48米" " -XX:CompileThreshold = 3000" " -XX:+ UseCodeCacheFlushing
JAVA_OPTS =" $ JAVA_OPTS" -Xms96m" " -Xmx96m" " -XX:NewRatio = 2
JAVA_OPTS =" $ JAVA_OPTS -Xss256k -Xmn36m"

当前的gc日志是:
23636.561:[Full GC(Last ditch collection)23636.561:[Tenured:34568K-> 34568K(61440K),0.1815189 secs] 34568K-> 34568K(94656K),[Metaspace:51111K-> 51111K(57344K)],0.1816524秒[时间:用户= 0.17 sys = 0.00,实际= 0.18秒]
23636.744:[完整GC(元数据GC阈值)23636.744:[终身:34568K-> 34609K(61440K),0.1811110秒] 34770K-> 34609K(94656K),[Metaspace:51111K-> 51111K(57344K)],0.1813034秒[时间:用户= 0.18 sys = 0.00,实际= 0.18秒]
23636.926:[Full GC(Last ditch collection)23636.926:[Tenured:34609K-> 34609K(61440K),0.1731652 secs] 34609K-> 34609K(94656K),[Metaspace:51111K-> 51111K(57344K)],0.1734136秒[时间:用户= 0.17 sys = 0.00,实际= 0.18秒]
23637.100:[Full GC(Metadata GC Threshold)23637.101:[Tenured:34609K-> 34567K(61440K),0.1757107 secs] 34667K-> 34567K(94656K),[Metaspace:51111K-> 51111K(57344K)],0.1758392 secs] [次:用户= 0.16 sys = 0.00,实际= 0.17秒]
23637.276:[Full GC(Last ditch collection)23637.276:[Tenured:34567K-> 34567K(61440K),0.1675901 secs] 34567K-> 34567K(94656K),[Metaspace:51111K-> 51111K(57344K)],0.1677021 secs] [次:用户= 0.16 sys = 0.00,实际= 0.17秒]
23637.447:[Full GC(Metadata GC Threshold)23637.447:[Tenured:34567K-> 34667K(61440K),0.1613939 secs] 35383K-> 34667K(94656K),[Metaspace:51117K-> 51117K(57344K)],0.1615529 secs] [次:用户= 0.16 sys = 0.00,实际= 0.16秒]
23637.609:[Full GC(Last ditch collection)23637.609:[Tenured:34667K-> 34667K(61440K),0.1629309 secs] 34667K-> 34667K(94656K),[Metaspace:51117K-> 51117K(57344K)],0.1631633 secs] [时间:用户= 0.15 sys = 0.00,实际= 0.17秒]

Jstat状态检查是:
1)./ jdk1.8.0_111 / bin / jstat -gc 3013 1000 5
 S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
3648.0 3648.0 0.0 0.0 29568.0 41.8 61440.0 35100.7 57344.0 51127.3 0.0 0.0 391 2.904 105988 17121.850 17124.755
3648.0 3648.0 0.0 0.0 29568.0 562.5 61440.0 35049.7 57344.0 51127.3 0.0 0.0 391 2.904 105994 17122.837 17125.742
3648.0 3648.0 0.0 0.0 29568.0 155.8 61440.0 35539.3 57344.0 51123.7 0.0 0.0 391 2.904 106000 17123.893 17126.797
3648.0 3648.0 0.0 0.0 29568.0 0.0 61440.0 35272.7 57344.0 51123.7 0.0 0.0 391 2.904 106005 17124.776 17127.681
3648.0 3648.0 0.0 0.0 29568.0 0.0 61440.0 35269.9 57344.0 51123.7 0.0 0.0 391 2.904 106011 17125.791 17128.696
2)./ jdk1.8.0_111 / bin / jstat -class 3013 1000 5
加载字节卸载字节时间
 23996 38866.6 15278 22602.0 2294.53
 23996 38866.6 15278 22602.0 2294.53
 23997 38868.1 15279 22603.6 2294.53
 23997 38868.1 15279 22603.6 2294.53
 23997 38868.1 15279 22603.6 2294.53

1 个答案:

答案 0 :(得分:0)

元空间占用率为98%,这超过了MinMetaspaceFreeRatio。