3

I started seeing frequent Full GC (with higher GC latency) on migrating to JDK 8 from JDK7. After analysing gc, found that after young GC, metaspace usage increases, while old gen usage remains same. I have set up a max metaspace size (equal to Perm Gen in JDK7) to 256MB. Full GC gets triggered when usage reaches around 210 MB. I have tried setting metaspace max size to 512MB, then also I see Metaspace Threshold leading to Full GC.

Why does Young GC cause metaspace size to grow ?

GC latency is spiking with JDK8. GC latency was normally below 100ms with JDK7, while it started spiking to 800-1000ms for Full GC with JDK8. This is impacting my application performance. I am using Parallel GC algorithm. I suspect that GC on metaspace is much more time-consuming than Old gen GC. Any suggestions on tuning JVM for JDK8 will be very helpful.

Young GC:

S0     S1     E    O     M      CCS   YGC  GCT  FGC  FGCT  GCT  LGCC      GCC 
0.00  40.28 99.78 21.95  56.28   -    149 6.647  2  3.276 9.924 Allocation Failure   No GC 
54.17 0.00  0.66  21.95  57.63   -    150 6.661  2  3.276 9.937 Allocation Failure   No GC

Full GC:

0.00  72.80   0.00  25.15  82.51      -    213    8.550     3    3.276   11.826 Metadata GC Threshold Metadata GC Threshold 
0.00  72.80   0.00  25.15  82.51      -    213    8.550     3    3.276   11.826 Metadata GC Threshold Metadata GC Threshold 

Metaspace used 216684K, capacity 262051K, committed 262144K, reserved 262144K 2015-06-30T17:47:16.079+0000: 17622.342: [Full GC (Metadata GC Threshold) [PSYoungGen: 9550K->0K(1035776K)]

Nachiket Kate
  • 8,473
  • 2
  • 27
  • 45
Shraddha
  • 2,337
  • 1
  • 16
  • 14
  • can u pull in some of the GC logs for us to have a look? – Amm Sokun Jul 02 '15 at 13:01
  • Please have a look at this http://java.dzone.com/articles/java-8-permgen-metaspace This won't solve issue but I think you will get some pointers. – Nachiket Kate Jul 02 '15 at 13:06
  • From logs, we can't see any full GC and total time for young GC was less than 100ms (~20ms). Either you have pasted wrong/not enough logs or read it wrong. – Nachiket Kate Jul 02 '15 at 13:18
  • That was young GC, showing increase in Metaspace size on Young GC. Also added Full GC log. – Shraddha Jul 02 '15 at 13:29
  • depends on the source you run, for example if you generate dynamic classes and load then and cache their instance for a while that will cause frequent young gc if it almost reaches young generation's ceiling, and loaded class will remain present in meta-space - also see http://stackoverflow.com/questions/26455482/java8-metaspace-heap-usage – jmj Jul 02 '15 at 17:49

0 Answers0