Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Low Latency Profiling Now Available in Java 8

Low Latency Profiling Now Available in Java 8

This item in japanese

Lire ce contenu en français

OpenJDK contributors have brought powerful low-latency profiling capabilities backwards into the publicly maintained Java 8, enabling developers to monitor JVM performance with low overhead. The tool, Flight Recorder, is available now in several open source implementations such as AdoptOpenJDK.

Java Flight Recorder (JFR) has been in development for over a decade and forms the underlying performance monitoring capabilities for JRockit and WebLogic Server. The tool was brought into HotSpot in the Java 8 and JDK 7u40 timeframe, as JRockit and HotSpot converged into a single JVM implementation. Unlike external performance monitoring systems, JFR is built directly into the JDK and can monitor performance in an accurate manner that does not mislead readers via safe points or sampling. The result of JFR is accurate performance diagnostics, where the act of measuring incurs only about a 2% overhead. These diagnostics provide developers and operators with the ability to gather actual performance data instead of making guesses or pointing fingers.

The code for JFR was made available as open-source in JDK11, available to all users without cost. Prior to this open-source work, the capability was available only in the Oracle JDK as a commercial feature that required a license of Java SE Advanced. Turning the feature on in the Oracle JDK required either a commercial feature flag, or a JMX connection that would enable commercial features. The backporting of JFR enables users of free JVM implementations to use JFR without incurring cost, provided they do so on a non-Oracle JVM. As Oracle ended public support for JDK 8 and requires a commercial license for their JDK 11+, many developers are switching to freely-maintained versions such as the one HotSpot distribution by AdoptOpenJDK.

JFR is usable by developers through two core mechanisms: Flight Recorder is an automated black box recorder that is already present inside the JVM and acts to record information. Mission Control is the visual console, run on a different system that enables operators to control the black box by evaluating metrics or creating performance snapshots.

There are several noteworthy differences between JFR and other commercial and public profilers. The most notable difference is that JFR is already present in the JVM and does not require any additional tools to be added or integrated. Other key differences extend from what is visible given that position. While many profilers focus on high-level metrics, such as request/response load times, the concept of a "web request" does not exist down at the JDK’s layer. As a result, the metrics provided by default in JFR are aimed more towards the JVM's raw operations. One feature in particular is advanced garbage collection analysis. Unlike common tools that simply report garbage collection statistics, the analysis capabilities within JFR provide details on what garbage was collected and who threw it away. This feature drives two conclusions that improve performance -- developers can identify specifically what to improve, and realize when tuning garbage collection is the wrong solution.

Developers looking to learn Flight Recorder can evaluate a prior presentation by Marcus Hirt, the JDK Mission Control project lead. Mikael Vidstet delivered a newer presentation on the same topic at QCon SF.

The analysis systems are available now in AdoptOpenJDK's early access builds, as the JDK 8 maintainers work on mainline. Complete and tested builds with JFR are also available from Azul Zulu.

Rate this Article