Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Using Java Mission Control & Java Flight Recorder


Published on

This presentation explains the Java Mission Control (JMC) and how to use it.

Java Mission Control has two main tools: JMX Console & Java Flight Recorder (JFR). These are very powerful tools provided by the Oracle JDK.

Published in: Software
  • Be the first to comment

Using Java Mission Control & Java Flight Recorder

  1. 1. Great tools in Java Development Kit 05 November 2014 Senior Software Engineer M. Isuru Tharanga Chrishantha Perera Using Java Mission Control & Java Flight Recorder
  2. 2. 2 Agenda ๏What is Java Mission Control (JMC) ๏Java Flight Recorder (JFR) ๏Using JMC ๏Demos
  3. 3. What is Java Mission Control? ๏A set of powerful tools running on the Oracle JDK to monitor and manage Java applications ๏Less performance overhead ๏Free for development use (Oracle Binary Code License) ๏Available in JDK since Java 7 update 40 ๏Two main tools: JMX Console & JFR ๏Supports Plugins 3
  4. 4. Java Process Browser ๏Uses the Java Discovery Protocol (JDP). ๏Allows to list and connect to both locally and remotely running Java applications. ๏JMC provides full secure access with encrypted communication and configurable user access restrictions. 4
  5. 5. JMX Console ๏A tool for monitoring and managing multiple Oracle JDK instances via JMX interface ๏Captures and presents live data about: ๏Garbage Collection (GC) Pauses ๏Memory (Heap Usage) ๏CPU Usage ๏Other attributes exposes via Mbeans ๏Provides triggers that can monitor Mbeansand trigger an action 5
  6. 6. Java Flight Recorder ๏A profiling and event collection framework built into the Oracle JDK ๏Gather low level information about the JVM and application are behaving without performance impact (less than 2%) ๏Always on Profiling in Production Environments ๏It’s like the “black box” used in aircraft 6
  7. 7. Data Collection ๏JFR stores data in a hierarchy of in-memory buffers. ๏The data is moved to the disk when the buffers are full ๏Initially the JFR stores data in thread-local buffers. (Improves throughput, no synchronization for every event) ๏Once the thread-local buffer has been filled, the data is transferred to a global buffer. (Requires synchronization) ๏After the buffers are full, the data is written to the disk 7
  8. 8. Data Analysis ๏JFR Plugin in JMC provides dynamic and in-depth analysis of all collected JFR data. ๏JFR enables users to analyze all aspects of a Java application ๏Can analyze the Code, Memory, Threads, Locks and I/O 8
  9. 9. Type of Events in JFR ๏Instant events –Events with only one time ๏Requestableevents –Events with a user configurable period ๏Duration events –Event with a start and end time ๏Timed events –Duration events with a user configurable threshold 9
  10. 10. Starting Java Mission Control ๏Run “jmc” command in $JAVA_HOME/bin ๏It runs on Eclipse ๏It can also be installed on your existing Eclipse ๏If it crashes with SIGSEGV on Ubuntu, try following ๏sudo-E sh-c 'echo org.eclipse.swt.browser.DefaultType=mozilla>> $JAVA_HOME/lib/missioncontrol/configuration/config.ini' 10
  11. 11. JMC Overview 11
  12. 12. Enabling Java Flight Recorder ๏The server VM needs to be started with following options ๏-XX:+UnlockCommercialFeatures-XX:+FlightRecorder ๏To produce a Flight Recording from the command line, you can use “-XX:StartFlightRecording” option. For example ๏-XX:StartFlightRecording=delay=20s,duration=60s,name=Test,filename=d.jfr,settings=profile ๏Use following to change log level ๏-XX:FlightRecorderOptions=loglevel=info ๏The command “jcmd” can also be used 12
  13. 13. Flight Recording from JMC ๏Right click on JVM and select “Start Flight Recording” ๏Select the type of recording: Time fixed / Continuous ๏Select the flight recording template ๏Modify the event options for the selected flight recording template (Optional) ๏Modify the event details (Optional) 13
  14. 14. Start Flight Recording Wizard 14
  15. 15. Event Options for Profiling 15
  16. 16. Event Details for Profiling 16
  17. 17. Demo ๏Enable JFR in WSO2 ESB ๏Sample applications from Marcus Hirt’sTutorials ( to demonstrate: ๏CPU Usage viewing in JMC ๏How to view deadlocked threads in JMC ๏Flight recording and observing Memory/Garbage Collections tab 17
  18. 18. References ๏Java Mission Control ๏Marcus Hirt’sBlog ๏Advanced Java Diagnostics and Monitoring Without Performance Overhead -Oracle Whitepaper ๏Oracle Java SE Advanced ๏InfoQ-Mission Control and Flight Recorder on HotSpotJVM ๏JMC & JFR -Diagnostic Tools 18
  19. 19. Contact us !