This article describes how to profile servers being run under BEA's WebLogic® system using the Sun Studio Performance Tools. The instructions are based on WebLogic 8.1, and were developed with LiYu Yi, of Boldtech Systems, Dallas, TX.
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. Setting Data Collection Options
Data OptionsThe command collect is the first token in the ${COLLECTOR} variable. You can specify it either as an absolute path to wherever you have installed the tools, or as the command name only, provided you have set your path to include the installation.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.
Experiment Naming and StorageYou can simplify the management of experiments by being careful at naming and storing them. You may name experiments with a -o argument specifying a name including the name of the server, followed by ".1.er". The first experiment will have the number 1, and subsequent ones will get consecutive numbers. You can also use the -d argument to specify a directory into which the experiments should be stored. It should be a locally-mounted, as opposed to NFS-mounted, file system.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.
Signal ControlsYou may use the -y <signal> option to collect to control when data is recorded during the session, and minimize the volume of collected data. You may start the experiment with data collection paused (thus not profiling the server during its startup), and send the signal to resume data collection either just before or shortly after applying a benchmark load to the server. You would send the same signal to pause data collection either shortly before or just after the benchmark load is terminated. You may repeat the resume/pause sequence for other loads, and terminate the server after all are done.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.
Descendant Process ControlsMany WebLogic Servers do not spawn additional processes, so -F on is not needed. If the server you are profiling does create additional processes that you wish to profile, you should enable -F to profile them, either for all descendants, or selectively, based on the name or lineage of the descendant of interest.
Archiving ControlsDepending on the environment under which you are profiling WebLogic Servers, you may examine the data on the machine on which it was recorded. If you want to examine it on a different machine, you should set -A copy to make the experiment more portable.Initiating Data CollectionThis section describes how you can modify the scripts used to launch WebLogic servers to enable data collection.
Simply-Launched ServersSome servers are simply launched by explicitly invoking one of two scripts, either the startWebLogic.sh script or the startManagedWebLogic.sh script. These scripts are relatively straightforward shell scripts, generated from the WebLogic Configuration Wizard. In each one, the last step is spawning a JVM to run the server.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.
Node-Manager Launched ServersThe BEA Node Manager is a Java process that controls servers, based on requests received from the Administration Console. It starts and stops specific servers. On Solaris, the Node Manager, by default, uses native libraries to do the launch, but it can be told to use a startup script instead. When so configured, each start command will invoke that script to start the server under profiling. The stop command will terminate the profiling run.In this case, we choose to name the script collectlaunch.sh; the two properties to be set are:
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. Server ProfilesThis 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).
WebLogic DocumentationDocumentation for WebLogic 8.1 can be found on BEA's web site; some particular topics of interest are:
Collect Launch Script
See Also: |
| |||||||||||||||||||||||
|
| ||||||||||||