Will Java Mission Control Replace Developer APM Tools?

IT professionals have a lot to think about. Let’s add two more thoughts to their queue. Are they wasting money on language-specific application performance monitoring tools? Will these developer-specific tools be replaced by Open Source software that is part of a standard language distribution kit?

Why do we ask? There are some early indicators that the answer to both questions might one day be “yes.”

Oracle has added a performance monitoring tool to Java 7 update 40: Java Mission Control. (Mission Control used to be called JRockit.) Before, you had to pay for Mission Control; now it is free. Mission Control is a console who’s plug-in, Java Flight Recorder, studies running Java applications and passes the information onto Mission Control for display.

Java Flight Recorder collects events from the operating system, the JVM, and the Java application. The tool looks at Java applications, monitoring what is going on with multiple-threads, memory, and individual methods. Oracle says its probe takes less than a 2% performance hit to an application.

The Flight Recorder works by gathering events and writing its data to disk to be studied later. Since writing to disk takes time, you can also configure it to keep a certain amount of data in memory and then throw out the oldest data when the buffer is full.

One performance area to watch is how threads are behaving. A Java program can spawn a new thread, or instance in the JVM, so that the application can do two things at once. To ensure that data remains synchronized–you cannot have one program change data while another it still holding onto a copy of it–the program tells the other program to sleep, wait, stop, or start. All of that sleeping and waiting can take time if there is a performance or design issue, and even deadlock, if two threads go after the same object at the same time.

Method profiling means looking inside the Java code to see what it is doing and how long it is taking. For example, the method (meaning function) com.mycompany.accounting.RunForever could be doing something not necessary like creating objects and filling them with data every time it runs instead of creating the data structure once and then referencing it when needed.

With Java, unlike C++, the programmer is supposed to be freed of the problem of having to deal with memory leaks, meaning a program that consumes memory by creating variables on the heap and then forgetting to delete them. Java is smart enough to know it can destroy objects when they go out of scope. This is called garbage collection. The problem is the object will never go out of scope if a reference to it is maintained when not necessary. The programmer might not know about this. Mission Control will find that.

There are also some plugins that you can download and add to Mission Control. One of these is DTrace. DTrace provides information from the operating system at whatever level you define. You can write your own set of probes (meaning define what you are looking for, called “events”) and then program that information to show up on the Mission Control console. DTrace requires a complicated configuration and even Java code, so you are going to need your programmers to help you with that.

This approach has a long way to go to be a full-fledged APM tool. It is simply too early to say that software like Mission Control will replace language-specific APM tools. Still, it is a development you should follow closely.