How to Enable the JRockit Mission Control Flight Recorder in Weblogic
JRockit Mission Control is a monitoring and troubleshooting application provided with Oracle JRockit. The JRockit Mission Control Flight Recorder registers the JVM’s metrics and events, garbage collection behavior, thread contention, locking, and other information, according to the configuration template you use. The default template has a very low overhead and can be used in production environments.
Below steps will enable the JRockit Mission Control Flight Recorder to store a flight recorder file (.jfr extension) for the Managed Server My_Server01 with the default template configuration. The recording will be configured to store the last 24 hours of events or the maximum of a 100 MB file.
1. Access the Administration Console by pointing your web browser to http://adminhost.domain.local:7001/console.
2. Click on the Lock & Edit button to start a new edit session.
3. Expand the Environment tree on the left and then click on Servers.
4. Click on the My_Server01 link and then click on the Server Start tab.
5. Add the following line of code to the Arguments field and click on the Save button:
-XX:FlightRecorderOptions=defaultrecording=true,disk=true,repository=./jfr/My_Server01,maxage=1440m,size=100m
6. Click on the Activate Changes button.
7. Restart My_Server01.
8. It will save the recording to the $DOMAIN_HOME/jfr/ My_Server01. The directory will be created automatically if it does not exist.
Once the above steps are completed, the JRockit Mission Control Flight Recorder is enabled and configured to store the last 24 hours of events, or until the file size reaches 100 MB.
There are many settings you can change for the JRockit Mission Control Flight Recorder. The parameters can be altered to save the events during the entire life cycle of the JVM. Change the maxage and size parameters to 0 as shown in the following line of code:
-XX:FlightRecorderOptions=defaultrecording=true,disk=true,repository=./jfr/My_Server0X,maxage=0,size=0
For every new recording, a new directory with the pattern $DOMAIN_HOME/jrf/<SERVER_NAME>/YYYY_MM_DD_HH_MM_SS_PID is created. The JFR must be opened in the JRockit Mission Control to be analyzed.
JRCMD Tool to record JFR
you can also use the jrcmd tool which comes with Jrockit to record jfr’s from outside on adhoc basis. Please follow below steps to do it so..
1) Login to the machine where Your Manage Server is running.
2) Find out the Process_id for the managed server. Run
$ ps -eaf | grep <ManagedServerName>
3) Start JFR using the following command to collect data for 5 minutes.
$ ./jrcmd <Process_ID> start_flightrecording duration=300s filename=/tmp/My_JFR_recording_oct1220pm.jfr
Example:
-bash-3.2$ ./jrcmd 12740 start_flightrecording duration=300s filename=/tmp/My_JFR_recording_oct1220pm.jfr 12740: Started recording 4
Note: jrcmd command is in <JAVA_HOME>/jdk6/bin directory and note down the JFR recording process id(here 4) as its required for few other commands.
4) At this time, you can run couple of flows in application and try to reproduce the error so that it will get caught in the JFR file.
5) Once all the tests are done either you can stop the recording and collect the jfr file or dump the recording to a file and can use the jfr file for analysis.
To Dump:
./jrcmd 20609 dump_flightrecording recording=7 copy_to_file=/tmp/JFR_recording_Server_1.jfr compress_copy=true
Below are few other usages:
If you want to stop the recording in middle, like you had given it to finish in 30mins but your tests finished in 20mins then you can manually stop the recording using following command.
-bash-3.2$ ./jrcmd 12740 stop_flightrecording recording=4
If you dont remember the recording id then you can use below command to check the id and status of recording process(s)
./jrcmd 12740 check_flightrecording
Example:
-bash-3.2$ ./jrcmd 12740 check_flightrecording 12740: Recording : id=1 name="WLDFDiagnosticImageRecording_MYDomain_ManagedServer_1_" duration=0s dest="/scratch/MYDomain/servers/ManagedServer_1/logs/diagnostic_images/__tmp1491633251405436781.jfr" compress=false (running) Recording : id=2 name="DMS" duration=0s (running) Recording : id=4 name="My_JFR_recording_oct1220pm.jfr" duration=300s dest="/tmp/My_JFR_recording_oct1220pm.jfr" compress=false (stopped)
If you are looking got the Java Mission Control Flight Recorder then please follow below URL for more info.
http://www.oracle.com/technetwork/java/javaseproducts/mission-control/java-mission-control-1998576.html
In case of any ©Copyright or missing credits issue please check CopyRights page for faster resolutions.
How to know whether JFR capture is auto enabled?
You need to check the Weblogic process running and what JVM arguments its holding to determine if JFR capture is auto enabled or not.
you can start and configure a recording from the command-line by using the -XX:StartFlightRecording start-up option:
-XX:StartFlightRecording=duration=,filename=
This command will start a recording immediately when the JVM starts. The recording then runs for the specified duration and will be saved to the given filename; for example, to starts a 60-second recording and to save the result in myrecording.jfr in the current directory, use this command:
-XX:StartFlightRecording=duration=60s,filename=myrecording.jfr