Markus Eisele

About Markus Eisele

Markus is a Developer Advocate at Red Hat and focuses on JBoss Middleware. He is working with Java EE servers from different vendors since more than 14 years and talks about his favorite topics around Java EE on conferences all over the world. Follow him on Twitter @myfear.

Java Mission Control 5.2 is Finally Here! Welcome 7u40!

It has been a while since we last heard of this fancy little thing called Mission Control. It came all the way from JRockit and was renamed to Java Mission Control. This is one of the parts which literally survived the convergence strategy between HotSpot and JRockit. With today’s Java SE 7 Update 40 you can actually use it again.

Java Mission Control 5.2

The former JRockit Mission Control (JRMC) is now called Java Mission Control (JMC) and is a tools suite which includes tools to monitor, manage, profile, and eliminate memory leaks in your Java application without introducing the performance overhead normally associated with tools of this type. Up to today the 5.1 version was available within the Oracle HotSpot downloads which could only be received by paying customers from the Oracle Support Website. Todays release is the first release of Java Mission Control that is bundled with the Hotspot JDK! The convergence project between JRockit and Hotspot has reached critical mass. With the 7u40 release of the Hotspot JDK there is an equivalent amount of Flight Recorder information available from Hotspot. And having it finally makes sense. Beside hundreds of minor fixes and improvements the JMC Client is now build to run on Eclipse 3.8.2/4.2.2 and is also featuring a new JVM Browser with server-side subnotes. This makes tracking of running recordings and JVMs a lot easier.

Java Flight Recorder (JFR)

But the main and most important feature is the Flight Recorder. The Flight Recording feature work with events. Those events need to be produced by the underlying JVM. Hotspot has now reached event convergence with JRockit. That means that most useful information that was provided from JRockit is now also available from Hotspot. And because those are quite different JVMs; the information will in some cases be a bit different. The overall profiling overhead for your applications still stays at less than 2%. Usually much less. Which, considering the information you get, is next to nothing.

JFR with GlassFish 4

Lets get your hands dirty and try this with latest GlassFish. First change your glassfish4\glassfish\config\asenv.conf/.bat and add AS_JAVA=PATH/TO/JDK7u40 now start the domain and navigate to the JVM options. Or as an alternative open glassfish4\glassfish\domains\domain1\config\domain.xml and search for the relevant java-config tag and add the following two jvm-options:

    <jvm-options>-XX:+UnlockCommercialFeatures</jvm-options>
  <jvm-options>-XX:+FlightRecorder</jvm-options>

Now restart the domain and look for the jdk1.7.0_40\bin\jmc and fire it up. If you’re running on the same machine you should already see a list of available JVMs in the JVM Browser. If you expand the GlassFish node and double click the “MBean Server” node you get a nice overview over what is happening right now:

overvoew

From there you can start a flight recording by right clicking the “Flight Recorder” node in the JVM Browser. Select the desired recording time and event settings (which now btw have a new template feature to pre select events and click finish. After the desired timeframe the recording gets downloaded to JMC and you can look through the timeline and find bottlenecks.

A very small drawback is, that you can’t run it with GlassFish 3. There is a know bug which got fixed for the 4.0 release about ordering of the jvm-options.

What is hot?

The best thing since sliced breed is, that you now have method profiling events! With the method profiling events you can find out where your application is spending the most time executing your Java code. This is, for instance, useful to optimize the application where the optimizations actually have an impact.

method_profiling

Further on you have an improved allocation profiling tab.You can now see per TLAB allocation with traces, and object being allocated directly in old space. That “new and improved” theme continues throughout the all tabs in the flight recorder. You get a File I/O, Socket I/O and many many more which provide plenty of insights.

Experimental Plugins

And the best part for me is that the team keep going with a bunch of experimental plugins. A new one was added called JOverflow – Heap dump analysis for memory waste. This plug-in allows Mission Control to do heap dump analysis, primarily to look for wasted heap space. There are several different anti-patterns JOverflow will look for, such as duplicate strings, underutilized collections etc. This plug-in also adds an action (for local connections) that will perform a heap dump and then visualize the heap dump with JOverflow. This is somehow a short term replacement for the Memleak Analyzer which you might know from JRMC. The D-Trace Plugins also got a major overhaul. You can find out more about it on Marcus Hirt’s blog.

Download and Further Reading

You can grep the latest 7u40 download from the Oracle Technology Network Java SE Download Page. Java Mission control is already integrated and you’re ready to run it.

If you need more information visit oracle.com/missioncontrol where you can find the links to the documentation and Eclipse update sites.
 

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.

Leave a Reply


9 × four =



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close