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)]