Using JRockit flight recorder to identify problems
JRockit Flight Recorder is a component of JRockit Mission control that can be used to record detailed statistics about your application, to be viewed later.
Getting ready
You will need SOA Suite installed for this recipe, and will need permission to execute the domain control scripts, as well as the JVM tools. This recipe assumes that your SOA Suite application is running under a normal load or a load sufficient to demonstrate any performance problems.
The tool jrmc
(of which Flight Recorder is a component) is included with the JRockit JVM; HotSpot has a different tool called VisualVM described in a different recipe. For brevity, this recipe assumes that you have the relevant JVM bin
directory on your path. If you do not, simply use the fully qualified paths to the relevant bin
directory.
How to do it…
Start JRockit Mission Control by following steps from 1 through 3 of the Identifying performance problems using JRMC on JRockit recipe.
Select the WebLogic instance that you want to connect to, based on the process ID that you established in step 1. Right-click on the instance and select Start Flight Recording. This will display the flight recording settings dialog box.
Accept the default Template and Filename settings, and set Name to be something descriptive. Recording Time should be long enough to encapsulate a use case that is considered to be slow. Once you are happy with the settings, click on OK and the recording will begin.
While recording is in progress, you can see the remaining time from the Flight Recorder Control view at the bottom of the screen.
Once the flight recorder finishes recording, it will open the Overview screen as shown:
This screen displays the overview of the recorded data. The event strip at the top of the screen can be used to select a specific part of the timeline to view. Clicking on Synchronize Selection will keep the selected time range the same across all the viewed screens.
Select the Memory tab; this tab shows us a number of interesting statistics about the JVM memory during the runtime. Notice that for more detailed information, you can select one of the subtabs at the bottom of the screen.
On this page, we want to check a number of things:
That the average and maximum Main Pause times are reasonable; for example, below 10 s
That the heap usage comes down by a reasonable amount when garbage collection occurs, and that it is not just "bouncing around near the top of the graph"
Select the CPU/Threads tab. This tab shows the statistics regarding CPU usage and threads. We want to check that the Application + JVM CPU usage does not make up the majority of the total CPU usage, and that the total CPU usage is low (ideally at 30 percent or below).
How it works…
JRockit Flight Recorder collects a large number of detailed statistics about an application execution, and stores them so that they can be analyzed later. This method allows a more detailed analysis to be performed then, if you are trying to observe the statistics in real time, you can go back and "replay" the gathered statistics to focus on certain time periods. Flight recorder can be executed with a number of profiles; the Normal profile has the lowest overhead, so is most suitable for use in production environments. The other profiles gather more information, but have a higher overhead, so are more suitable when you can reproduce the problem in a test environment. One of the advertised powerful features of JRockit is that the Normal collection profile adds virtually no overhead to the JVM execution time, as the collected metrics are used internally by JRockit during execution for runtime optimization.
It can be helpful to take Flight Recorder profiles of healthy systems, so that if a future release introduces a performance problem, you have a baseline to compare it to. This can make it much easier to identify the area in which performance is likely to be suffering. With SOA Suite in mind, it is worthwhile using Flight Recorder when running load tests (see Chapter 3, Performance Testing) against the WebLogic servers.
See also
The Identifying performance problems with JRockit Mission Control recipe