JavaOne 2013: Java Mission Control Flight Recorder1

JavaOne 2013: Java Mission Control

The convergence project between Oracle’s JVMs JRockit and Hotspot is making significant progress. Included in the latest Java 7 JDK update (‘7u40’) is a new powerful monitor tool: Java Mission Control (JMC). JMC is a production time tool that has its roots in the JRockit JVM tooling. It is located in the bin folder of your 7u40 JDK. At JavaOne I attended some interesting sessions by Marcus Hirt (Oracle) on this new Java Mission Control. In this article I will describe an introduction based on my session notes to get you started and links to further explore JMC.

Flight Recorder1

Introduction

JMC is intended to be the new tool for monitoring, managing, diagnosing, and profiling your Java applications. It is built into the JVM. It is meant for production use but it can of course be very valuable in any environment (development, test). It gives a basic monitoring, profiling and diagnostics information. Oracle claims that it has a very low overhead of less than 2%.

Oracle’s JVMs JRockit and Hotspot convergence

The JRockit and HotSpot features are currently being merged into one JVM. The intention with the merge is to make a ‘best of breed’ JVM. This is a project that is still going on but now with JDK release 7u40 it has reached a very big milestone; Mission Control for Hotspot. It is intended as an 1.0 release but released as version 5.2.0. Delivered in the JDK 7u40 release are:

  • JMX Console – for monitoring running Java processes in real time and monitoring of a few select key indicators
  • Java Flight Recorder – profiling of running production systems (like a data flight recorder  in an aircraft) with minimal overhead

Memleak, a very useful JRockit heap-analyser, is unfortunately not available yet in JMC but will be in the future.

JMC installation

-You can download the 7u40 JDK or higher here:

-To enable access to the Flight Recorder four Java parameters must be set (this is not yet dynamically enabled like in JRockit). In WebLogic  for example you can set the parameters in  <your path to WLS Domain>/bin/startWebLogic.cmd:

  • -XX:+UnlockCommercialFeatures
  • -XX:+FlightRecorder
  • -Dcom.sun.management.jmxremote.authenticate=false
  • -Dcom.sun.management.jmxremote.ssl=false

WebLogic java prop

– Double-click on the launcher in bin folder to start JMC:

start JMC

JMX Console

You can start a JMX console by a right mouse click on a JVM:

start JMX console

The JMX Console is a tool for monitoring and managing multiple JVMs. It captures and presents basic live performance data about garbage collection pauses, memory and CPU usage, as well as performance information from any (custom) JMX MBeans deployed in the JDK MBean server.

JMX Console1

Java Flight Recorder (JFR)

The Java Flight Recorder (JFR) is in my opinion a very useful and the most powerful tool of JMC. With JFR operation teams and developers have a new tool to diagnose production issues. JFR provides a way to collect events from a Java application, from the OS layer, the JVM, the CPU, and all the way up to the Java application. The collected events include JVM memory, garbage collections, thread latency, events such as sleep, wait, lock contention, and method profiling. The performance metrics are written to the disk and analysis can be done afterward if problems have occurred. Because of the low performance overhead, it is save to put JFR always on in production environments.

Hot packages and classes:

Flight Recorder3 hot packages classes

Java Mission Control Future

Oracle is currently working on version 5.3.0 of JMC. This version will be released with JDK 8 and a later 7 update. It will include an improved JMX Console (Remote Diagnostic Commands and more), improved content type handling and formatting. Oracle is also working on version 6.0.0 which includes an automatic analysis of JFR recordings.

Experimental plugins

JOverflow is one of the many promising, experimental (and not supported) plugins. JOverflow is for analyzing heap waste (empty/sparse collections)

JMC as external tool in JDeveloper12C

-If you want to play with JMC in JDeveloper 12C, you can add JMC as an external tool to JDeveloper and use it directly from JDeveloper’s menu. The current JDeveloper version (12.1.2) ships with JDK version 1.7.0_15 and includes a limited previous version of JMC ( 5.1). To make JMC 5.2 available, you need to change the JDK JDeveloper uses. Copy and paste your 7u40 JDK in your oracle_common directory: Middleware1212\Oracle_Home\oracle_common and rename the folder to jdk (but first rename your old jdk folder)

jdk7u40 in oracle_common pasted

– Go to the JDeveloper menu, Tools and external Tools:

JMC as tool in JDev

Now JMC is directly startable from JDevelopers menu.

Links

One Response

  1. Md. Bappy October 7, 2013