This document discusses Java Mission Control (JMC) and Java Flight Recorder (JFR), which are tools for monitoring and managing Java applications. JMC provides a graphical user interface for viewing runtime data from Java applications, including garbage collection, memory usage, and CPU usage. Java Flight Recorder is a low-overhead profiling and event collection tool that is built into the Java Development Kit. It can collect detailed information about a Java application's code, memory, threads, and I/O without significant performance impact. The document provides instructions for starting JMC, enabling JFR, and performing flight recordings to analyze application behavior.
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
Using Java Mission Control & Java Flight Recorder
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
Agenda
๏What is Java Mission Control (JMC)
๏Java Flight Recorder (JFR)
๏Using JMC
๏Demos
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. 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. 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. 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. 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. 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. 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. 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
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. 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
17. Demo
๏Enable JFR in WSO2 ESB
๏Sample applications from Marcus Hirt’sTutorials (http://hirt.se/blog/?p=611) to demonstrate:
๏CPU Usage viewing in JMC
๏How to view deadlocked threads in JMC
๏Flight recording and observing Memory/Garbage Collections tab
17
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