|
| By Marty Itzkowitz, Project Lead, Sun Studio Performance Tools, Sun Microsystems, August 25, 2006 |
|
| |
To profile WebLogic servers, you will need the Sun Studio 11 Performance Tools running on a supported version of the Solaris OS or Linux, including any required patches. You will also need a supported version of Java installed. Running the
collect command with no arguments will run a script that will verify that all the appropriate patches are installed. (See also
Profiling Java Applications With Sun Studio Performance Tools
, and the
Sun Studio Performance Analyzer documentation
.)
A server run under BEA's WebLogic is a Java application that you launch by running a script to invoke the JVM. To profile a server, you must ensure that the JVM command launching the server is prepended with a collect command, with appropriate arguments, to invoke the Sun Studio Collector. In the discussion below, the shell variable ${COLLECTOR} is used to refer to that command and arguments.
In the next section, we describe setting ${COLLECTOR} for the data collection options you will want to use. In the second section we describe the scripts used to launch a server, and how to edit them to insert ${COLLECTOR}. In the third section, we describe navigating through the measured performance data. Finally, in the last section, we give links to the BEA WebLogic documentation.
The default experiment is a clock-profiling experiment. You may also use hardware counter profiling or sychronization tracing. The experiment begins when the server is launched, and terminates when the server exits. If the profiling session is longer than about 20 minutes, low-resolution profiling should be used to avoid high volumes of data.
Since WebLogic servers are Java-based, the -j on option to collect is always needed.
You may want to use the date command to generate a string representing the current date and time and embed that string in the experiment name.
To profile server initialization, you would use -y <signal>,r , send the signal after initialization, and then send it again before and after a load is applied, as above.
If data volume is not a problem, but you will be running multiple loads in a single session, you may pass the -l <signal> option to collect, and send the signal to insert sample markers after initialization and then after each benchmark load is applied.
When using either of these techniques, you should disable periodic sampling, using the -S off option to collect. WebLogic does not interfere SIGPROF, so you can use it to generate samples or to toggle pause/resume, or to generate samples, but not both. Such use does not interfere with SIGPROF usage for clock-profiling. You can use a second signal, SIGUSR1, for example, if you want to both control pause and resume and to insert sample markers in the experiment.
This section describes how you can modify the scripts used to launch WebLogic servers to enable data collection.
To profile WebLogic servers launched with either of those scripts, edit the script to prepend ${COLLECTOR} (as determined above) to the line that launches the JVM.
In this case, we choose to name the script collectlaunch.sh; the two properties to be set are:
| Property | Value |
| StartTemplate | collectlaunch.sh |
| NativeVersionEnabled | False |
To create a very simple version of collectlaunch.sh, find the nodemanager.sh script in the WebLogic installation, and use it as a template for collectlaunch.sh. Edit that script to have it use a ${COLLECTOR} variable to control launching the JVM, as above. Then, set properties for the Node Manager to tell it to use the new script, and restart the Node Manager. When a server is started by the NodeManager, with ${COLLECTOR} set as above, the experiment is started. When it is stopped by the Node Manager, the experiment is terminated.
The simple script above will use the same profiling for all servers it launches; for selective control over profiling of the server system, you may set up two domains for two Node Managers, and control which servers are profiled by moving servers between Node Managers.
Alternatively, a more complicated collectlaunch.sh script can be created to read a simple configuration file, and use it to decide which servers are profiled, and with which arguments. The launch script used by the Node Manager is invoked with four arguments:
One of the tokens in the arguments passed to the JVM is -Dweblogic.Name= <name> You may use sed to extract the server name from it and use it to format the experiment name, or directory, or to find specific collection parameters for that server from a configuration file.
The second argument is a full path to the file to be used for stdout. You may change the script to extract the directory from that path, and use it to put experiments in the same place the Node Manager logs are put.
The Node Manager launch script is expected to write the PID of the launched server to the file named with The fourth argument You may also write it to a script that will send the signal for pause-resume or sample control for the process. Or you may want to edit a more general script to simultaneously send the signal to all monitored processes.
An example of such a complex script appears below. The script also automatically creates a shell-script file named kill. name that can be executed to send SIGPROF to the target server, to simplify use of the signal controls described above.
This section describes tips for examining the server profiles.
Unless your server has created additional descendant processes which are profiled, and single run creates a single experiment. No experiment filtering or selectivity is needed.
If you have used either of the signal mechanisms described above you may use sample filtering in the Analyzer or er_print to examine the profile for only part of the run. For example, you may want to look at the startup only, or you may want to look at the data for the individual benchmark loads that were run.
When looking at the Timeline in Analyzer, you may want to color methods from the WebLogic infrastructure all one color, and use other coloring to look at specific sections of you code. You can also show or hide clock profile events that are not CPU-time (that is, they are system CPU-time, or any of the wait states).
#!/bin/sh
|
| |
| |
