Monday, 31 December 2012

JProfiler Installation & Configuration for Weblogic

In below details you will be able to configure the Jprofiler in Weblogic server environment. Profiling the Weblogic application server is tricky. By following the below steps you can easily set up the environment.
Refer below link for complete JProfiler documentation. (JProfiler Documentation)

1.     Introduction

JProfiler eases developers in creating more efficient applications by improving their performance. It is oriented towards testing and exploring different aspects of the performance of a Java program, concerning the operation of the JVM making use of available platform resources.

JProfiler provides the following functionality:
·         Memory consumption measurement
·         Memory stack frames tracing
·         CPU loads profiling
·         Momentary heap allocation information
·         Thread state progress statistics
·         Visual representation of VM work loads by different parameters
·         Source code reference
·         Garbage collection during profiling
·         Remote profiling
·         Profiling only of a particular stage or a combination of several stages of the program life cycle
·         Using different target environments
·         Saving profiler information for further examination
·         Exporting profiler information in text format

On the all the servers that has JProfiler component listed, following steps have to be carried out:-
1)Login to the linux box as a non-root user

2)Download the TAR.GZ Archive ( jprofiler_linux_7_1_2.tar.gz) for JProfiler  and keep the license key with you.

3)Upload jprofiler_linux_7_1_2.tar.gz to the box (for eg in /home/oracle  directory)

4) Execute the below commands:
                   gunzip jprofiler_linux_7_1_2.tar.gz
tar xf jprofiler_linux_7_1_2.tar

5) Ensure the software to export display is available in the local box (E.g Xserver) and it is running

6) Ensure JRE is set with version >1.5

2.1.1     Additional Steps to be carried out on the JProfiler Server

After completing the Steps listed above in Section 2.1,

1) Navigate to the JProfiler Install Directory

  Ensure that JAVA_HOME & DISPLAY variables are set.
2) Execute the shell script under extracted JProfiler folder
                   <JProfiler Directory>/bin/jprofiler

3) Enter the license key and click on evaluate (this is for trial version), below screen will be shown. Note: License key is only required where JProfiler GUI will be running.




4) To update the license information click on ‘Help’ and then ‘Enter License Key’


Update the information as required ,Click OK to complete License Update.

2.2.1     Profiling Weblogic Admin Server


Modify the server startup script you want to profile as below.  For example if you want to profile the admin server modify the startWebLogic.sh  to append the JProfiler argument

JAVA_VM=
export JAVA_VM
JPROFILER_OPTIONS="-agentpath:<JProfiler Directory>/jprofiler7/bin/linux-x86/libjprofilerti.so=port=<xxxx>,nowait $JPROFILER_OPTIONS"
export JPROFILER_OPTIONS

Note:- If the java version used by Weblogic/jrockit is 64 bit, change the jprofiler lib path in the above section to <JProfiler Directory>/jprofiler7/bin/linux-x64

Add ${JPROFILER_OPTIONS} to the below portion of the startWeblogic script.
if [ "${WLS_REDIRECT_LOG}" = "" ] ; then
        echo "Starting WLS with line:"
        echo "${JAVA_HOME}/bin/java ${JPROFILER_OPTIONS} ${JAVA_VM} ${MEM_ARGS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}"
        ${JAVA_HOME}/bin/java ${JPROFILER_OPTIONS} ${JAVA_VM} ${MEM_ARGS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}
else
        echo "Redirecting output from WLS window to ${WLS_REDIRECT_LOG}"
        ${JAVA_HOME}/bin/java ${JPROFILER_OPTIONS} ${JAVA_VM} ${MEM_ARGS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WL_HOME}/server/lib/weblogic.policy ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}  >"${WLS_REDIRECT_LOG}" 2>&1
fi


Make changes in above script:
  1. Give the JProfiler installation directory
  2. Give the port number to open the connection for JProfiler Agent.
  3. Restart the server.

  • Step 1: Navigate to the JProfiler Install Directory, Ensure that JAVA_HOME & DISPLAY variables are set.
  • Step 2: Execute the shell script under extracted JProfiler folder , <JProfiler Directory>/bin/jprofiler
  • Step 3: JProfiler window will open , click on ‘Session’ and select ‘New Session’. In case you have saved the session earlier  please skip to Step 9.

  • Step 4: Select ‘Attach to profiled JVM (local or remote)’

  • Step 5: Enter the Host name for the application server need to profiled and the port number (configured in step 2.2)
  • Step 6: Enter the session name as required and click ‘OK’. This session will be saved and next time you can directly open the session.
  • Step 7: JProfiler will try to connect to profiled application server , once connected below screen appears.
Select Instrumentation.
  • Step 8: JProfiler will start collecting data & below screen will be displayed. Start / Stop the several Jprofiler recording as per requirement. 
  • Step 9: In case if you have already saved the session earlier. Open the JProfiler window , Click ‘Session’ and select ‘Open Session’

  • Step 10: Select the previous saved session and Click ‘Open’.

  • Step 11: Click ‘OK’ , Reports will be generated like screenshot attached in Step 8.



No comments:

Post a Comment