Sunday, April 3, 2011

Profiling Weblogic Server Application using Netbeans Profiler

The idea behind this profiling is to have a better idea about the application performance using the Netbeans profiler that depends on the JVM capabilities..



We will do the following steps:

1) Open setDomainEnv.cmd and ensure the Sun JDK is already defined or add the definition yourself:

SET SUN_JAVA_HOME=C:\bea\jdk150_11

The profiler will not work unless it is a Sun JDK.
Mostly WebLogic come with 2 JDK one is Rocket and the other is Sun JDK.

2) In startWebLogic.cmd Switch web logic to use Sun JDK by the following line:

SET JAVA_VENDOR=Sun SET JAVA_HOME=C:\bea\jdk150_11

3) In startWebLogic.cmd point to profiler profilerinterface.dll & its library by the following line

SET JAVA_OPTIONS=-agentpath:"C:\Program Files\NetBeans 6.8\profiler3\lib\deployed\jdk15\windows\profilerinterface.dll=\"C:\Program Files\NetBeans 6.8\profiler3\lib\"",5140 %JAVA_OPTIONS%

Now open Netbeans and do the following:

4) Go to the menu -->Tools & Java Platforms

Add Weblogic sun JDK to the current platoforms (the same you used in Weblogic configuration)

5) Go to the menu -->Profiler-->Advanced Command-->Run Profiler Calibratation
Select Weblgoic JDK

This will let Netbeans calibrate the JDK.

6) Go to the menu -->Profile --> Attach profiler

- Add filter: Inclusive (osa.ora.*) as filtration for the needed package classes.

- Select localhost , Weblogic 9 (works fine with Weblogic 10 as well).


Now the final steps, must do them in sync with each other:

7) Start the Weblogic server using startWeblogic.cmd, it will stop waiting for the profiler.

8) In Netbeans click on Attach the profiler.


Now enjoy using the Netbeans profiling tools for your application..

You can check the methods duration and number of invocation , the thread count, heap size , Garbage collection statistics ,etc..you need to check..

You can select what you want during configuring the profiler or later on by changing them.

This tutorial is done in WinXP and using Netbeans 6.8 and Weblogic 10.

2 comments:

  1. Hi, what if my weblogic server is in a linux server ? What is the address for the Server location ?

    ReplyDelete
    Replies
    1. It will work without any issues, you need to use the corresponding scripts at the end of the NetBeans profiler wizard.
      Usually it is installed under Oracle directory.

      Delete