Thursday 22 January, 2009

HPROF In JCAPS512

Introduction:
HPROF is a profiling agent which interacts with JVMPI and collects profiling information in to a file or socket. The profiling information collected can be either in ASCII or binary format. HPROF can produce profiling information related to CPU, heap usage, threads in the stack trace, depth of the trace etc. The profiling information so collected can be viewed by using agent like HAT etc.

Configuration in Application server Admin console:

In order to run the profiler, an argument needs to be passed to the jvm by specifying various options for which the profiling information needs to be captured.

To find out the various hprof options, run the following command in the command prompt with the path set to your directory where jdk is installed.

java -Xrunhprof:help.

Once a decision has been arrived on the options for which the profiling information is required, perform the following steps to configure and run HPROF profiler.

Login to asadmin (ex: - http://localhost:18000/asadmin).
Click on the JVM Settings tab and select the profiler option.
Give the profiler name as hprof and enable the profiler option. Leave the classpath and native library path as blank.
Click on the Add JVM option and enter the args.ex: - (-Xrunhprof: depth=3,file=c:\temp\log.txt,thread=y,heap=all).

Advantages:

· Helps in analyzing performance related issues.
· Helps in understanding bottlenecks.
· Helps in analyzing memory leak issues.
Note: Configuring HPROF in the App server will be an overhead as far as the performance is considered.