Java Mission Control Harald Bräuning
Resources Main Resource: Java Mission Control Tutorial by Marcus Hirt http://hirt.se/downloads/oracle/jmc_tutorial.zip includes sample projects! Local copy: /common/fesa/jmcexamples/jmc_tutorial.zip More Resources http://oracle.com/missioncontrol The Oracle Java Mission Control homepage http://hirt.se/blog Java Mission Control articles
Java Monitoring Tools /common/fesa/jmcexamples/10_console_loadanddeadlock/target/jnlp/bin/deadlock.sh jconsole monitors CPU usage memory usage number of loaded classes thread count and information displays and allows to change MBeans
Java Monitoring Tools jvisualvm modern Netbeans based user interface extensible via plugins GPLv2+CE licensed monitors CPU usage memory usage number of loaded classes threads thread count state (running, sleeping, wait,...) sampling and profiling (CPU and memory usage) can incur a large overhead displays and allows to change Mbeans (via separate plugin)
Java Monitoring Tools /common/fesa/jmcexamples/10_console_loadanddeadlock/target/jnlp/bin/deadlock.sh jvisualvm
JMC - Java Mission Control 3rd tool after JConsole and JVisualVM previously available only in the commercial JRockit JVM based on Eclipse RCP direct integration into Eclipse IDE possible in principle extensible via plugins out of the box, two major components: MBean Server (JMX Console) online monitoring manages beans Flight Recorder analysis of recorded data (also offline) event based: low overhead / impact on JVM explicit activation necessary licensing not 100% clear!
JMC - License As per the Binary Code License, all usage for evaluation and development (on your laptop/workstation) is always royalty free (even if/when you use the commercial features flag). As a developer, you can use JMC and JFR to build, debug and optimize your application without owing Oracle a cent. We only charge for production use so if you build a web app and deploy it to a server and the JVM that runs it has the commercial features flag enabled then you need a Java SE Advanced license for the server. The desktop that runs the JMC GUI never needs a license. Henrik Stahl VP Product Management, Java, Oracle
MBean Server Overview /common/fesa/jmcexamples/10_console_loadanddeadlock/target/jnlp/bin/deadlock.sh
MBean Server Threads /common/fesa/jmcexamples/10_console_loadanddeadlock/target/jnlp/bin/deadlock.sh
MBean Server Triggers /common/fesa/jmcexamples/10_console_loadanddeadlock/target/jnlp/bin/deadlock.sh
MBean Server Browser MBeans provide a means to manage your application.
JFR Java Flight Recorder The Java Flight Recorder must be explicitly activated on starting the JVM! Maven Netbeans IDE
JFR Start Recording recording must be explicitly started specifying recording time recording is automatically stored in a file can be used for later offline analysis data is automatically displayed at end of recording
JFR Overview Overview Panels: similar data to MBeans Server CPU usage heap usage JVM information system properties recording properties
JFR Overview Zoom into any time interval is possible!
JFR Profiling /common/fesa/jmcexamples/02_jfr_hotmethods/
JFR Profiling
JFR Profiling Ersetze LinkedList durch HashSet
JFR Latencies /common/fesa/jmcexamples/03_jfr_latencies/ A symptom of a latency related problem can be lower than expected throughput in your application, without the CPU being saturated. This is usually due to your threads of execution stalling, for example due to bad synchronization behaviour in your application.
JFR Latencies Events/Graph: Shows the events emitted by the application
JFR Latencies Events/Histogram: Shows the event counts and stack trace
JFR Latencies Threads/Latencies: Shows the relative count for thread stall events of different types
JFR Latencies Threads/Contention: Contains information about the locks, blocked and blocking threads
JFR Latencies Threads/Lock Instances: Contains information about the lock instance events
End
MBeans This lesson introduces the fundamental concept of the JMX API, namely managed beans, or MBeans. An MBean is a managed Java object, similar to a JavaBeans component, that follows the design patterns set forth in the JMX specification. An MBean can represent a device, an application, or any resource that needs to be managed. MBeans expose a management interface that consists of the following: A set of readable or writable attributes, or both. A set of invokable operations. A self-description. The management interface does not change throughout the life of an MBean instance. MBeans can also emit notifications when certain predefined events occur. The JMX specification defines five types of MBean: Standard MBeans Dynamic MBeans Open MBeans Model MBeans MXBeans