Tuesday, March 25, 2014

Remote Profiling Oracle SOA application server using NetBeans7.4

In this section, I will share my experience profiling the Oracle SOA Suite application server using NetBeans 7.4 from Windows7 desktop - where the WLS SOA managed server is running on a remote Enterprise Linux 5 machine. Here are the main steps:

A. Choose Profile > Attach Profiler (Attach Profile icon) from the main menu of Netbeans IDE to open the Attach Profiler dialog box.

Specify the location of the application and the connection method.



B. Before profiling, perform the following

Step 1: Make sure the target application is configured to run using Java 6+.

Step 2: If you have not done it before, create a Remote profiling pack (click the link in the IDE message window) for the selected OS & JVM and upload it to the remote system.

 - Download the profiling pack file 'profiler-server-linuxamd64.zip' that will be created and copy to the remote location. (extracted dir contents of the zip below)

profiler-server-linuxamd64
|- bin
|- lib
- README

Step 3: If you have not run profiling on the remote system yet, run the <remote>/bin/calibrate-16.sh script first to calibrate the profiler.

You should see something like

profiler-server-linuxamd64]$ ./bin/calibrate-16.sh 

Profiler Agent: JNI OnLoad Initializing...
Profiler Agent: JNI OnLoad Initialized successfully
Starting calibration...
Calibration performed successfully
For your reference, obtained results are as follows:
Approximate time in one methodEntry()/methodExit() call pair:
When getting absolute timestamp only: 2.0325 microseconds
When getting thread CPU timestamp only: 1.85 microseconds
When getting both timestamps: 3.84 microseconds

Approximate time in one methodEntry()/methodExit() call pair
in sampled instrumentation mode: 0.0425 microseconds

Step 4: Add the following parameter(s) to the SOA application startup script:

- Add JVM Options property to $DOMAIN_HOME/bin/startManagedWebLogic.sh

JAVA_OPTIONS="${JAVA_OPTIONS} -XX:+UseLinuxPosixThreadCPUClocks -agentpath:<remote>/lib/deployed/jdk16/linux-amd64/libprofilerinterface.so=<remote>/lib,5140"
export JAVA_OPTIONS

Step 5: Start the target application. The process will wait for the profiler to connect.

On starting the soa_server1, you should see something like this in the server diagnostics log
.........
Profiler Agent: Waiting for connection on port 5140 (Protocol version: 14)

Step 6: Submit to close the Attach Settings dialog

Step 7: Click the Attach button in the Attach Profiler dialog to connect to the target application server and resume its execution.

................
Profiler Agent: Established connection with the tool
Profiler Agent: Standard session
<Feb 11, 2014 3:04:43 PM PST> <Info> <Security> <BEA-090905> <Disabling the CryptoJ JCE Provider self-integrity check for better startup performance. To enable this check, specify -Dweblogic.security.allowCryptoJDefaultJCEVerification=true.> 
<Feb 11, 2014 3:04:43 PM PST> <Info> <Security> <BEA-090906> <Changing the default Random Number Generator in RSA CryptoJ from ECDRBG to FIPS186PRNG. To disable this change, specify -Dweblogic.security.allowCryptoJDefaultPRNG=true.> 
<Feb 11, 2014 3:04:43 PM PST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) 64-Bit Server VM Version 24.45-b08 from Oracle Corporation.> 
<Feb 11, 2014 3:04:44 PM PST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 12.1.3.0.0  Wed Dec 11 11:57:28 PST 2013 1567342 > 
<Feb 11, 2014 3:04:47 PM PST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING.> 

C. The IDE attaches to the remote JVM and you can view the profiling data of the remote SOA WLS managed server as for a local application

   - sample Snapshot of the VM Telemetry view displaying info on Classes loaded and running Threads




You can find more details about NetBeans7.4 profiling capabilities in the official NetBeans7.4 documentation chapter "Testing and Profiling Java Application Projects".