Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HPjmeter: User's Guide > Chapter 3 Getting Started

Monitoring Demonstration Instructions

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

HPjmeter includes two sample applications that you can run to see live examples of a “memory leak” and a thread deadlock situation. You will be able to use the visualizers to examine data during the demonstration session.

Here are the general steps for running the sample applications.

  1. Start the console.

  2. Start the node agent if it is not running as a daemon.

  3. Start the sample application from the command line:

    cd $JMETER_HOME/demo
    export LD_LIBRARY_PATH=$JMETER_HOME/lib
    java -agentlib:jmeter agent.jar -jar ML1.jar

    As a convenience, HPjmeter includes a script that sets up the library path and bootclasspath using a JVM found at installation time. To use this script, type:

    cd $JMETER_HOME/demo
    ../bin/run_simple_jvmagent -jar sample_program

    Use the file name of the specific sample you want to run in place of sample_program.

  4. In the console main window, click Connect and type in the host name of the machine that runs the sample application. If you specified a port number when starting the node agent, use the same port number. Otherwise, leave the port number box empty.

  5. An icon representing the host appears in the main window. After a few moments, the console also shows the sample application as a child node of the host.

  6. Double-click the application node to open a monitoring session with the application.

    The dialog box for setting session preferences will open.

  7. Click OK to accept the default settings for metrics, filters and alerts.

    The console main window now displays the open session.

Memory Leak Application

This sample application demonstrates how the memory leak alerts work in HPjmeter. The example uses a simple Java program, which allocates some objects, and uses a java.util.Vector object to retain references to some of the objects, thus exhibiting the behavior of a memory-leaking application.

This application is configured to leak memory at the rate of about 10 MB per hour. The demo application is available from the HPjmeter installation directory:

Source: $JMETER_HOME/demo/ML1.java

Binary: $JMETER_HOME/demo/ML1.jar

Use only the class name, ML1 with the run_simple_jvmagent script to start the sample.

When measuring the sample applications, allow considerable time for the heap to mature and stabilize, and for the JVM agent to collect memory leak data. Eventually, you will see two alerts:

When using the default garbage collectors and heap size for HotSpot 1.4.2 JVM, the detection of a memory leak for this demonstration program occurs after about 20 minutes. This time can be substantially longer when using a different JVM or non-standard garbage collector or heap settings.

In real situations, the detection time depends on the maximum heap size, the size of the leak, the application running time, and the application and load characteristics. Typically, the detection will occur in about one hour.

Here is a memory leak alert for the sample program:

Example alerts in memory leak detection

Here is the heap display for the sample program:

Figure 3-1 Heap Display Showing Possible Memory Leak Behavior

Heap Display Showing Possible Memory Leak Behavior

See also Heap Usage Alert.

Thread Deadlock Sample

This sample application demonstrates how HPjmeter detects deadlocked threads.

The example creates pairs of threads every 30 seconds, stopping at 50 threads, which synchronize work using shared locks. Occasionally, the program reverses the order on which locks are taken, eventually causing a deadlock, which generates a Thread Deadlock Alert.

The demo application is available from the HPjmeter installation directory:

Source: $JMETER_HOME/demo/DL1.java

Binary: $JMETER_HOME/demo/DL1.jar

Use only the class name, DL1 with the run_simple_jvmagent script to start the sample.

Use the Thread Histogram display to see the thread activity. Deadlocked threads show a solid red bar.

Figure 3-2 Thread Deadlock Example Display

Thread Deadlock Example Display
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2006 Hewlett-Packard Development Company, L.P.