 |
» |
|
|
 |
The latest version of HPjmeter can be downloaded
from: : http://www.hp.com/go/hpjmeter HPjmeter can be used to identify
and diagnose performance problems in Java applications running on
HP-UX. It can be used for both static and dynamic data analysis. For
static data analysis, HPjmeter can analyze profile,
GC or heap data generated by the following command-line options: -XX:+HeapDumpOnOutOfMemoryError
When using JDK 1.5.04 or later, the Java VM can generate
an Xeprof file using zero preparation (no
command-line option required). HPjmeter can also
perform dynamic data analysis with real-time monitoring of Java applications. The following table lists the features of HPjmeter 3.1. The first two rows are static features and
the remaining four rows are dynamic features. Table 1-11 HPjmeter 3.1 Features Drill down into application profile metrics Graphic display of profiling data Call graphs with call count, or with processor or
clock time Per thread display of time spent Per thread or per process display
| | Integrated HPjtune functions with concurrent
improvements in tool and help usability | | Ability to examine Java Management Extension management
beans (Mbeans) content and the Java VM internal memory configuration | Automatic problem detection and alertsMemory leak detection alerts with leak rate Thread deadlock detection Abnormal thread termination detection Expected out of memory error Excessive method compilation
| Dynamic real-time display of application behaviorGarbage collection events and percentage time spent
in garbage collection CPU usage per method for hottest methods
| Object allocation percentage by methodObject allocation percentage by object type Method compilation count in the Java VM dynamic compiler Number of classes loaded by the Java VM Thrown exception statistics Multi-application, multi-node monitoring from a single
console
|
HPjmeter can display data generated
by the following Java product versions, on the specified architectures,
with the specified HP-UX operating system, as detailed in the following
table: Table 1-12 Java SDKs and JDKs Supported by HPjmeter 3.1 | Java Version | Architecture | HP-UX Versions | | SDK 1.4.2.02 or later | PA-RISC 1.1, PA-RISC
2.0 | 11i v1 (11.11), 11i v2 (11.23), 11i v3 (11.31) | | JDK 5.0 or later | PA-RISC 2.0 | 11i v1 (11.11), 11i v2 (11.23), 11i v3 (11.31) | | JDK 6.0.00 or later | PA-RISC 2.0 | 11i v1 (11.11), 11i v2 (11.23), 11i v3 (11.31) | | SDK 1.4.2.02 or later | Itanium® | 11i v2 (11.23), 11i v3 (11.31) | | JDK 5.0 or later | Itanium | 11i
v2 (11.23), 11i v3 (11.31) | | JDK 6.0.00 or later | Itanium | 11i v2 (11.23), 11i v3 (11.31) |
The HPjmeter console can be
run on: PA-RISC HP-UX 11i v1 (11.11), 11i v2 (11.23), 11i
v3 (11.31) Integrity HP-UX 11i v1.6 (11.22), 11i v2 (11.23),
11i v3 (11.31)
The user's guide for HPjmeter can be found at: http://docs.hp.com/en/dev.html#Java More information on HPjmeter, including free software downloads, can be found at: http://www.hp.com/go/hpjmeter Static Data Analysis |  |
Using HPjmeter to Analyze Profiling DataThe following steps summarize how to collect and view profiling
data from your application. For applications running on HP-UX, use the extended
profiling option -Xeprof to capture profile data,
and then view the data in HPjmeter. For applications
running on non-HP-UX platforms, you can use -Xrunhprof or -agentlib:hprof options, and use HPjmeter to view the data. (For more details, refer to thehprof section.) The examples in this section use the -Xeprof option. Change the command line of your Java application to
use -Xeprof. To collect Xeprof data during
the entire execution of the launched Java application, use: You can send the Xeprof output to a specified file using the file= keyword as follows: $ java -Xeprof:file=<yourApp>.eprof <yourApp> |
The <pid> will be inserted automatically
in the file name, for example, <yourApp><pid>.eprof. To collect Xeprof data for a specified time interval, there
are two options. Turn on/off profiling based on specified time since
program start: $ java -Xeprof:time_on=<start_time>,time_slice=<length_of_collection_time> <yourApp> |
Turn on/off profiling using signals (for example, sigusr1 and sigusr2): $ java -Xeprof:time_on=sigusr1,time_slice=sigusr2 <yourApp> |
The generated filename will include the time between the start
of an application and the start of profiling, for example:
Run the application to create a data file. Start the console from a local installation on your
client machine. For example, here are two different ways: $ $JAVA_HOME/bin/java <heap_settings> -jar /opt/hpjmeter/lib/HPjmeter.jar |
$ /opt/hpjmeter/bin/hpjmeter |
Click File—>Open
File to browse for and open the data file. A profile analysis screen opens, displaying a set
of tabs containing summary and graphical metric data. The following
screen shows an example: Click among the tabs to view available metrics. Use
the Metrics or Estimate menus to select additional metrics to view. Each metric you select
opens in a new tab. Hover your mouse over each category in the cascading
menu to reveal the relevant metrics for that category. The following
screen shows the available metrics for the threads/locks category:
Using HPjmeter to Analyze Garbage Collection
DataThe following steps summarize how to collect and
view garbage collection data from your application: When running on HP-UX,
add the -Xverbosegc option to the Java command line.
(On non-HP-UX platforms, use the -Xloggc option instead.) Run the application to
create a data file. Start the console from
a local installation on your client machine. For example, here are
two different ways: $ $JAVA_HOME/bin/java <heap_settings> -jar /opt/hpjmeter/lib/HPjmeter.jar |
$ /opt/hpjmeter/bin/hpjmeter |
Click File—>Open File to browse for and open the
data file. A GC viewer screen opens
and displays a set of tabs containing metric data. The following figure
shows the garbage collection analysis screen:
Dynamic Data Analysis |  |
Using HPjmeter to Monitor ApplicationsThe following steps show how to start the monitoring
agent when launching the HPjmeter console. For
most Java installations, linkage to the appropriate libraries is completed
automatically as part of the installation process, and, therefore,
the first step is not needed. Begin with the second step if you have
a standard installation of the Java Runtime Environment. Set the SHLIB_PATH environment variable to include the location of the HPjmeter agent library as appropriate for 32 or 64-bit Java VM. The following examples show how to set this variable
in both the csh and the ksh for
the different libraries. To select the PA-RISC 32-bit library: (csh) $ setenv SHLIB_PATH /opt/hpjmeter/lib/PA_RISC2.0
(ksh) $ export SHLIB_PATH=/opt/hpjmeter/lib/PA_RISC2.0 |
To select the PA-RISC 64-bit library: (csh) $ setenv SHLIB_PATH /opt/hpjmeter/lib/PA_RISC2.0W
(ksh) $ export SHLIB_PATH=/opt/hpjmeter/lib/PA_RISC2.0W |
To select the Integrity 32-bit library: (csh) $ setenv SHLIB_PATH /opt/hpjmeter/lib/IA64N
(ksh) $ export SHLIB_PATH=/opt/hpjmeter/lib/IA64N |
To select the Integrity 64-bit library: (csh) $ setenv SHLIB_PATH /opt/hpjmeter/lib/IA64W
(ksh) $ export SHLIB_PATH=/opt/hpjmeter/lib/IA64W |
Confirm that the node
agent is running. With a standard installation, the node agent should
be running as a daemon on the system where it was installed. A node
agent must be running before the console can connect to a managed
node to discover applications and open monitoring sessions. To verify that the node agent is running, use the following ps command: The last output column (the args column) from ps should show the following: $ JMETER_HOME/bin/nodeagent -daemon | where JMETER_HOME=/opt/hpjmeter. The -daemon flag indicates that the node agent
is running as a daemon.If the node agent is not running, follow these
steps to enable it: Verify that you are logged in with root permissions. Verify that the following files exist: /sbin/init.d/HPjmeter_NodeAgent /sbin/rc3.d/S999HPjmeter_NodeAgent
Issue the following command to start the node agent
daemon manually. Note: substitute start with stop to stop the node agent. $ /sbin/init.d/HPjmeter_NodeAgent start |
If you cannot use the node agent as a daemon or you
need to set up access restrictions, start the node agent manually
by issuing the following command (no root access needed):$ /opt/hpjmeter/bin/nodeagent | By default, the node agent listens for console connections on port
9505. Use the -port port_number option to specify
an alternate port number. Start the Java application
with the Java VM agent. For example, to start the myapp application on JDK 1.5, enter (For JDK 6.0, replace “java1.5” with “java6”): $ /opt/java1.5/bin/java -Xms256m -Xmx512m -agentlib:jmeter myapp | On SDK 1.4.2 versions enter:$ /opt/java1.4/bin/java -Xms256m -Xmx512m \
-Xbootclasspath/a:$JMETER_HOME/lib/agent.jar -Xrunjmeter myapp | This enables the myapp process to be dynamically
monitored with the console.Start the HPjmeter console by entering the command: $ /opt/hpjmeter/bin/hpjmeter |
Connecting to the Node Agent From the HPjmeter ConsoleSetting Session PreferencesDouble-click the Java
VM icon in the data pane for the application that you want to monitor.
This opens the Session Preferences dialog box
shown in the following screen: Check the default settings
for metrics, filters, and alerts, and enable the settings you want
to activate. Click OK. The Session Preferences screen closes and
the newly Open Session is visible, marked by the icon. Refer to the following screen
for an example: Wait for the console to
collect metrics. The length of time depends on the application size,
the load imposed on the application, and the selected preferences.
Typically, the wait will be from 5 to 30 minutes. Longer collection
time gives you greater accuracy in the results.
Viewing Monitoring Metrics During Your Open SessionClick the open session
or time slice to highlight the data to be viewed. Use the Monitor menu on the console main screen to select the desired metrics. Refer
to the following screen for an example: Select a metric. A metric
visualizer displaying the chosen data opens. Refer to the HPjmeter User’s Guide for details on individual
metrics and how to interpret the data.
Running the HPjmeter Sample ProgramsHPjmeter includes two sample
applications you can run to see live examples of a memory leak and
a thread deadlock situation. You can use the visualizers to examine
data during the demonstration session. The following general steps show how to run the
sample applications: Start the console. Start the node agent if
it is not running as a daemon. 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 the Java VM found at installation time. Follow
these instructions to use this script:$ 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.In the console main screen,
click Connect and enter the host name of the
machine running 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. An icon representing the
host appears in the main screen. After a few moments, the console
also shows the sample application as a child node of the host. Double-click the application
node to open a monitoring session with the application. Click OK to accept the default settings for metrics, filters, and alerts.
Sample Memory Leak ApplicationThis application demonstrates how memory leak
alerts work in HPjmeter. It uses a simple program
which allocates some objects. The program uses a java.util.Vector object to retain references to some of the objects. This application
is configured to leak memory at the rate of about 10 MB per hour.
It is available from the HPjmeter installation
directory: Source: $JMETER_HOME/demo/ML1.java
Binary: $JMETER_HOME/demo/ML1.jar |
Use the class name ML1 with the run_simple_jvmagent script
to start the sample. When measuring the sample application, allow
considerable time for the heap to mature and stabilize, and for the
Java VM agent to collect memory leak data. Eventually, you will see
the following two alerts: Expected OutOfMemory Error Alert with the leaking
rate Memory Leak Locations Alert with the leak location
When using the default garbage collectors and
heap size for SDK 1.4.2, the detection of a memory leak for this demonstration
program occurs after about 20 minutes. This time may be substantially
longer when using a different Java VM or nonstandard 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 occurs in about one hour. The following figure is a memory leak alert for
the sample program: The following figure is the heap screen: Sample Thread Deadlock ApplicationThis application demonstrates how HPjmeter detects deadlocked threads. It 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 sample application is available from the HPjmeter installation directory: Source: $JMETER_HOME/demo/DL1.java
Binary: $JMETER_HOME/demo/DL1.jar |
Use the class name DL1 with the run_simple_jvmagent script
to start the sample. Use the Thread Histogram screen to view the thread activity. Deadlocked threads show a solid
red bar. The following figure is the Thread Histogram screen:
|