In [1], Marcus has written an excellent article on "Creating Flight Recording." Based on his advice, we have created a JFR recording with object allocations inside/outside TLAB (Thread Local Allocation Buffer) enabled. Then, we installed Java Mission Control (an Eclipse plug-in) on our 64-bit Windows platform and used it to investigate object allocations in the recording.
In this article, we will visit the following topics:
Following Marcus' Time Fixed Recording example, we have used the following command line options:
In our example, we started the recording for 5 minutes after Hotspot has run for 7800 seconds. To configure the recording, you can use either template provided in jre/lib/jfr folder:
For our example, we have chosen the default template (note that the settings parameter can also take a path to a template) in which we have enabled the following settings:
Note that we have saved an original copy of default.jfc before making the changes. After running our benchmark, it has generated a recording file named:
Table 1 Oracle JDK 7 Java Mission Control Support
You can follow the instructions from [2] to download Java Mission Control—an Eclipse plug-in. However, instead of using https, you should use http as shown above. Also, be noted that
In this article, we will visit the following topics:
- Generating JFR recording
- Downloading and installing Java Mission Control
- Note that Java Mission Control (JMC) is for Hotspot as JRockit Mission Control (JRMC) is for JRockit.
- Viewing object allocations using Java Mission Control
Generating JFR Recording
Following Marcus' Time Fixed Recording example, we have used the following command line options:
- -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:StartFlightRecording=delay=7800s,duration=300s,name=MyRecording,filename=/tmp/myrecording.jfr,settings=default
In our example, we started the recording for 5 minutes after Hotspot has run for 7800 seconds. To configure the recording, you can use either template provided in jre/lib/jfr folder:
- default.jfc
- profile.jfc
For our example, we have chosen the default template (note that the settings parameter can also take a path to a template) in which we have enabled the following settings:
<flag name="allocation-profiling-enabled" label="Allocation Profiling">true</flag> <event path="java/object_alloc_in_new_TLAB"> <setting name="enabled" control="allocation-profiling-enabled">true</setting> <setting name="stackTrace">true</setting> </event> <event path="java/object_alloc_outside_TLAB"> <setting name="enabled" control="allocation-profiling-enabled">true</setting> <setting name="stackTrace">true</setting> </event>
Note that we have saved an original copy of default.jfc before making the changes. After running our benchmark, it has generated a recording file named:
- myrecording.jfr
Downloading and Installing Java Mission Control
Capability |
Oracle JRockit JDK6 (R28+) |
Oracle JDK 7 GA |
Oracle JDK 7u40+ |
Host JRMC/JMC GUI |
Yes (JRMC) | Yes (JMC) | Yes (JMC) |
WLDF JFR Events and Analysis |
Yes | Yes | Yes |
JFR, JMC Convergence (JVM Events) |
Yes | No | Yes |
You can follow the instructions from [2] to download Java Mission Control—an Eclipse plug-in. However, instead of using https, you should use http as shown above. Also, be noted that
Java Mission Control 5.2.0 does not support Kepler, only Juno.[3,4]
So, you need to download Eclipse Juno from here. If you installed JMC in Eclipse Kepler, you would see the problem as reported in [5].
After opening myrecording.jfr, select Memory tab group on the left as shown above. The Memory tab group shows Information on memory management and garbage collections. It is comprised of these tabs:
To recap: when we did the recording, we have enabled the following events:
Viewing object allocations using Java Mission Control
After opening myrecording.jfr, select Memory tab group on the left as shown above. The Memory tab group shows Information on memory management and garbage collections. It is comprised of these tabs:
- Overview Tab
- Garbage Collections Tab
- GC Times Tab
- GC Configuration Tab
- Allocations Tab
- Object Statistics Tab
To recap: when we did the recording, we have enabled the following events:
- java/object_alloc_in_new_TLAB
- java/object_alloc_outside_TLAB
- Allocation in new TLAB
- Allocation outside TLAB
References
- Creating Flight Recordings
- Oracle Java Mission Control Downloads
- Java Mission Control for Eclipse
- Oracle® Java Mission Control
- Oracle® Java Mission Control is a set of plug-ins for Eclipse 3.8 or 4.2.
- Mission Control and Flight Recorder on HotSpot JVM
- Which JVM?
- If opening JFR recordings takes forever, you may need to increase heap size.
- JDBC in Java Mission Control
- JDK Mission Control (JMC) 8.1.0 Downloads
No comments:
Post a Comment