JDK16 ZGC problems when started

560 views Asked by At

Recently,I try to do some test on JDK16's new GC ,namely ZGC ,but when I plan to reset the value of GC paramter -XX:+UseLargePages and the JVM start failed .In the log ,it says ,

[2021-04-15T20:11:10.094+0800] Heap Backing File: /hugepages/java_heap.13015 [2021-04-15T20:11:10.094+0800] Heap Backing Filesystem: hugetlbfs (0x958458f6) [2021-04-15T20:11:10.095+0800] Min Capacity: 28672M [2021-04-15T20:11:10.095+0800] Initial Capacity: 28672M [2021-04-15T20:11:10.095+0800] Max Capacity: 28672M [2021-04-15T20:11:10.095+0800] Medium Page Size: 32M [2021-04-15T20:11:10.095+0800] Pre-touch: Disabled [2021-04-15T20:11:10.095+0800] Available space on backing filesystem: N/A [2021-04-15T20:11:10.095+0800] Uncommit: Implicitly Disabled (-Xms equals -Xmx) [2021-04-15T20:11:10.095+0800] Failed to commit memory (Not enough space) [2021-04-15T20:11:10.095+0800] Failed to commit memory (Not enough space) [2021-04-15T20:11:10.095+0800] Failed to commit memory (Not enough space) [2021-04-15T20:11:10.095+0800] Forced to lower max Java heap size from 28672M(100%) to 28432M(99%) [2021-04-15T20:11:10.095+0800] Failed to allocate initial Java heap (28672M) [2021-04-15T20:11:10.102+0800] Runtime Workers: 10 parallel [2021-04-15T20:11:10.102+0800] Using The Z Garbage Collector Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit.

do have you the same problem? what did you do to solve the tough issue ?

1

There are 1 answers

0
Mikko Rantalainen On

In my experience, ZGC doesn't seem to be smart enough to successfully use large pages (also known as huge pages or 2MB pages) in many cases. The startup randomly fails so often with large pages support enabled that I've opted to take the performance hit and add -XX:-UseLargePages to disable the large pages support. Note that ZGC has large pages support enabled by default at least on 64 bit Linux hosts.

It would be great if JVM had similar feature to PostgreSQL where it by default tries to use huge pages support to automatically falls back to normal 4 KB page allocations if huge pages fails for any reason.

I'm running with a system with zero reserved huge pages but swap and huge page overcommit enabled which seems to be good enough for all the other software but JVM.