Creating Fully Featured JRA Recordings with 1.4 Based JRockits (Migrated from the old BEA blog)
By Hirt on Aug 04, 2008
One of the parts of Mission Control is the JRA (the JRockit Runtime Analyzer). The JRA is a powerful profiler that can tell you a lot about the performance bottlenecks in your application whilst keeping the overhead barely noticeable.
There are new options added to the JRA recordings almost every release. In recent releases of Mission Control the JRA wizard will check what capabilities the JRockit you are attempting to start a recording on has, and present you with configurable options accordingly. The problem is that the legacy protocol used when connecting to a 1.4 version of JRockit unfortunately does not support querying for the available parameters. Do not despair; there are still means of starting JRA recordings that contain all the new goodies. This is how:
There is a neat little command line tool called jrcmd that can be found in JROCKIT_HOME/bin. The jrcmd tool can be used to invoke commands on a locally running JRockit process. It works like this:
JROCKIT_HOME/bin/jrcmdto list the JRockit processes on your machine.
- Pick your favourite one and do
JROCKIT_HOME/bin/jrcmd <pid> help
- Pick the command you wish to know more about, for example
JROCKIT_HOME/bin/jrcmd <pid> help startjrarecording
- Invoke the command with the settings of your choice.
In this case, the command we want to use is startjrarecording, and what we want to know is what parameters we can use on a particular JRockit when issuing the startjrarecording command.
On the windows box I'm currently on, it looks like this:
Notice how it lists itself. In this case I'm interested in knowing the available commands on the JRockit currently running my Mission Control (com.jrockit.mc.rcp.start.MCMain), so I do:
D:\jrockits\R27.3.0_R27.3.0-106_1.5.0>bin\jrcmd.exe 2640 help
The following commands are available:
For more information about a specific command use 'help
Parameters to commands are optional unless otherwise stated.
To find out what parameters are available to me when starting a jrarecording I do:
D:\jrockits\R27.3.0_R27.3.0-106_1.5.0>bin\jrcmd.exe 2640 help startjrarecording
Starts a JRA recording.
filename - name of the file to store JRA recording to
recordingtime - length of the recording in seconds (int, 60)
delay - delay before starting recording in seconds (int,
methodsampling - enable method sampling (bool, true)
gcsampling - enable gc information (bool, true)
heapstats - include heap statistics (bool, true)
nativesamples - include native code in sampling (bool, false)
methodtraces - include stack traces (bool, true)
tracedepth - depth of stack traces (int, 16)
sampletime - time between samples in milliseconds (int, 30)
zip - zip the recording (bool, true)
hwsampling - use hardware sampling if possible (bool, false)
threaddump - do full threaddumps at start and end of recordning
threaddumpinterval - also do threaddumps every 'n' interval (can be
specified as x[ns|ms|s]) (time, 0s)
latency - include latency analysis (bool, false)
latencythreshold - do not record events shorter than this number (can
be specified as x[ns|ms|s]) (time, 20ms)
cpusamples - sample cpu usage during the recording (bool,
cpusampleinterval - cpu sample interval (can be specified as
x[ns|ms|s]) (time, 1s)
In this case I found out that I can indeed start up a recordings with new features such as latency analysis data on this particular JVM. To actually start such a recording I could for example write:
D:\jrockits\R27.3.0_R27.3.0-106_1.5.0>bin\jrcmd.exe 2640 startjrarecording laten
cy=true latencythreshold=20ms recordingtime=120s
JRA recording started.