News and views from members of the Java team at Oracle
While language and API changes often take up the focus of a JDK release, JDK 27, also includes a number of changes to the underlying runtime. In this article we will cover all the noteworthy runtime changes that are coming in JDK 27.
If you are interested in more changes coming in the JDK 27 release, check out Declassifying the Java 27 Release! covering all the changes that would primarily impact developers. Also be sure to watch the Java 27 livestream on September 15th starting at 15:00 UTC on the Java YouTube Channel.
Three of the nine JEPs that are in the JDK 27 release primarily have runtime impacts, or would be used by system admins to monitor the health of an application.
G1GC has been the de facto default garbage collector since JDK 9. However, in cases where only limited system resources were available, Serial GC was used instead. Because of continued improvement to G1 over subsequent releases, even in cases of limited system resources, G1 is still often the best option. As a result G1GC will be the default GC used in all cases unless you explicitly request to use an alternative GC. As always worth reiterating, there isn't a singular "best GC", each GC makes a set of tradeoffs between CPU utilization, memory utilization, pause time, and potentially specific implementation details within a GC might positively or negatively impact the KPIs of your application. So always test and measure your GC choice and configuration for best results.
Compact Object Headers, were introduced as a final feature in JDK 25, and will now be enabled by default in JDK 27, meaning you no longer need to pass -XX:+UseCompactObjectHeaders to use them. Compact Object Headers reduce the size of the metadata for objects, which should reduce overall heap size by about 20% which also have some nice down stream benefits like reducing GC pressure. Compact Object Headers can be disabled with -XX:-UseCompactObjectHeaders.
JFR will now by default redact sensitive information like passwords and api keys if passed in as JVM arguments or environmental variables. You can also add your own filters which are case insensitive glob patterns with * and ? as wildcard options. The additional filters can be added to the redact-arguments for JVM arguments and redact-key for environmental and system properties sub-options of -XX:FlightRecorderOptions.
For example if you wanted to filter the environmental property of dburl you'd accomplish that with this this command:
$ java -XX:FlightRecorderOptions:redact-key=dburl
If you have many filters, consider defining them in a separate file and reference the file:
text
$ java -XX:FlightRecorderOptions:redact-arguments=@args.txt
When defining custom filters, to including default filters prefix the first filter with a +:
text
$ java -XX:FlightRecorderOptions:redact-key=+dburl
You can disable the default filters by passing in none:
text
$ java -XX:FlightRecorderOptions:redact-key=none
The default filters cover many of the most common examples of sensitive data that should be redacted:
Default redact-key filters:
*api*key*
*auth*
*client*secret*
*credential*
*jaas*config*
*passphrase*
*passwd*
*password*
*private*key*
*pwd*
*secret*
*token*
Default redact-argument filters:
*api*key*
*client*secret*
*credential*
*jaas*config*
*passphrase*
*passwd*
*password*
*private*key*
*pwd*
*secret*
*token*
*api*key*
*client*secret*
*credential*
*jaas*config*
*passphrase*
*passwd*
*password*
*private*key*
*pwd*
*secret*
*token*
Releated to this JEP, the help command for -XX:FlightRecorderOptions has been updated to cover the new redact-key and redact-arguments options.
The jcmd command-line tool has three new features.
$ source <JDK_HOME>/conf/bash-completion/jcmd
For system-wide availability, place the script in the /usr/share/bash-completion/completions/ directory.
The new command, VM.security_properties, has been prints the current set of Java security properties for a running JVM process, similar to the existing VM.system_properties command for system properties. This enhancement provides an easy and scriptable way to diagnose and troubleshoot security-related configuration issues.
The output of the VM.info command and HotSpot fatal error logs (hs_err_pid) now include the current number of open file descriptors for the running Java process. On supported platforms, the new output displays the active file descriptor count in the SYSTEM section.
There have been a few updates to JVM Arguments in this release.
Several JVM arguments have been removed; -noclassgc, -noverify, -verifyremote and the -Xverify:none, all these arguments have previously been deprecated.
The argument -noclassgc has been replaced by -Xnoclassgc which offers the same functionality.
The argument -verifyremote has been replaced by -Xverify:remote which also offers the same functionality.
There is no replacement for -noverify or -Xverify:none.
The command line option -XX:InitiatingHeapOccupancyPercent has been renamed to -XX:G1IHOP as it's only meant to be used with the G1GC. The old option -XX:InitiatingHeapOccupancyPercent is still available, but has been deprecated, and will likely be removed in a future release, so update your startup commands appropriately.
The HotSpot JVM option -XX:[+|-]UseCompressedClassPointers was deprecated in JDK 25, and is now obsolete in JDK 27. The JVM now always uses compressed class pointers. Using the command will result in a warning message being printed.
There are a few other noteworthy updates that don't fit neatly into any single category.
The JSON format thread dump generated by com.sun.management.HotSpotDiagnosticMXBean.dumpThreads, and $ jcmd Thread.dump_to_file, now generate the JSON values for thread identifiers, thread counts, and the process identifier as numbers instead, of strings e.g. { "tid": 3, .. }. Programs that parse the JSON format thread dump may need to be updated to handle this change.
As part of the change, the threadDump object now has a new member formatVersion for the thread dump format (with a value of 2), which will be updated as the thread dump format evolves.
The JFR event jdk.OldObjectSample is disabled when using generational ZGC due to unacceptable performance overhead.
RuntimeMXBean.getInputArguments() now adds the -XX: prefix for arguments passed via a settings file. Previously, arguments from a settings file were returned without the -XX: prefix, for example +UseZGC. Now, these arguments are returned with the -XX: prefix, for example -XX:+UseZGC.
The experimental JVM Compiler Interface (JVMCI) has been removed in this release. These changes include the removal of JVMCI code from HotSpot JVM, modules jdk.internal.vm.ci, jdk.graal.compiler and jdk.graal.compile.management, the JVMCI-specific JIT-compilation policies, configure feature selection flags, and all flags containing the string "JVMCI" as well as -XX:+UseGraalJIT.
The Serviceability Agent printmdo command has been removed. printmdo is a sub-command of clhsdb tool, and used for displaying MethodData, which is JVM internal compi]ler information.
The G1 garbage collector changes the default values of the options -XX:MinHeapFreeRatio to 40 and 70 and -XX:MaxHeapFreeRatio to 0 and 100. As a result, G1 heap resizing is effectively disabled by default.
The previous default values could have triggered heap expansion or shrinkage after a Full GC, potentially causing unnecessary heap resizing, particularly for applications that frequently invoke System.gc().
Applications that explicitly set -XX:MinHeapFreeRatio or -XX:MaxHeapFreeRatio will retain the heap resizing behavior based on the settings that have been given.
That is all the noteworthy runtime updates in JDK 27. For more on JDK 27, check out Declassifying the Java 27 Release! that covers changes for developers, and be sure to watch the Java 27 Launch Livestream.
JEP 523: Make G1 the Default Garbage Collector in All Environments
JDK-8364182 New jcmd Command VM.security_properties Displays Active Security Properties at Runtime
JDK-8359706 VM.info and hs_err_pid Logs Now Report Current Open File Descriptors
JDK-8373481 Removal of -noclassgc, -noverify, -verifyremote and -Xverify:none Options
JDK-8227106 Rename -XX:InitiatingHeapOccupancyPercent to -XX:G1IHOP
JDK-8363996 The UseCompressedClassPointers Option Is Now Obsolete
JDK-8382740 JFR Event jdk.OldObjectSample Disabled for Generational ZGC
JDK-8377797 Remove SA support for printing MethodData and the printmdo command
JDK-8238686 Change the Default Values of MinHeapFreeRatio and MaxHeapFreeRatio for G1