Jump to content WorldWide-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com Home
HP-UX 11i  >  WLM

Using HP-UX Workload Manager with BEA WebLogic Server™

» 

HP-UX 11i

» Latest release
» Virtualization
» Security
» High availability
» Disaster tolerance
» Management
» Software development
» Internet & networking
» Open source software
» Packaging - OEs
» Utility pricing
» Products index

Leadership UNIX

» Lowest UNIX TCO
» Run it on blades
» Performance 
» ISVs’ v3 quotes
» The Real Story

Learn more:

» Information library
» Executive update
» Customer successes
» Knowledge-on-Demand technical Webcasts
» Transition from other environments

Related products

» Services
» HP-UX 11i storage
» HP Integrity servers
» HP 9000 servers
» Integrity solutions

Get what you need:

» Releases & media
» HP software from Software Depot
» HP-UX technical forum
» Technical documentation
» Training courses
» Events & user forums
» Section map
Content starts here
$Revision: 1.19 $
$Date: 2006/04/17 21:31:20 $

»  1 Abstract
»  2 Goal
»  3 Target audience
»  4 Abbreviations used
»  5 Workload requirements
»  6 Security of the workloads
»  7 Platforms used for this paper
»  8 Separating processes into WLM workload groups
» 8.1 WLM overview
» 8.2 WLM's separation mechanisms
» 8.2.1 Application records: workload separation by binary name
» 8.2.2 User records: workload separation by process owner UID
» 8.2.3 prmrun: starting a process in a workload group
» 8.2.4 Default: inheriting workload group from parent process
»  9 WLM workload and resource monitoring tools
»  10 Overview of WebLogic concepts
» 10.1 Installing WebLogic Server
» 10.2 WebLogic Server workloads
» 10.2.1 WebLogic Server instance layout
» 10.2.2 Figure: default WebLogic Server instance layout
» 10.2.3 Multiple-instance WLS configurations
» 10.3 WebLogic Server environment setup and instance start
» 10.3.1 Start scripts: startWebLogic.sh & startManagedWebLogic.sh
» 10.3.2 POSIX sh environment setup files: setEnv.sh
» 10.4 Monitoring and managing the WebLogic instance
» 10.4.1 WebLogic Server command-line tools
» 10.4.2 WebLogic Server Console
»  11 WebLogic Server metrics to use with WLM
» 11.1 WLS queues
» 11.2 WLS queue metrics
»  12 How to use the WLS metrics with WLM
» 12.1 Metric collection: wlmwlsdc
» 12.1.1 Metrics available through wlmwlsdc
» 12.1.2 wlmwlsdc usage
» 12.1.3 wlmwlsdc properties
» 12.1.4 wlmwlsdc POSIX environment variable scripts
» 12.1.5 Nonnumeric wlmwlsdc output
» 12.1.6 Running wlmwlsdc by hand for benchmarking
» 12.2 Metric smoothing: cntl_smooth
»  13 Choosing among the example use cases
» 13.1 Common elements of example use cases
» 13.1.1 FSS groups
» 13.1.2 PSET-based groups
» 13.1.3 vPar-based groups
» 13.2 Getting started: benchmarking with manual allocations
» 13.2.1 Simple allocations to gauge resource needs
» 13.2.2 Measuring workload queue metric behavior
» 13.2.3 Running wlmwlsdc directly from command line
» 13.2.4 Observing workload queue metric use from WLS tools
» 13.3 Moving to automatic WLM control
» 13.3.1 Workload types and suitable use case choices
» 13.3.2 Comparison of example use case major features
» 13.4 Customization to match your workloads and goals
»  14 Allocating CPU manually
» 14.1 Single instance vs other workloads
» 14.1.1 Use case
» 14.1.2 Variations
»  15 Allocating CPU based on CPU consumed
» 15.1 Single instance vs other workloads
» 15.1.1 Use case
» 15.1.2 WLM setup
» 15.1.3 Running and monitoring
» 15.1.4 Tuning
» 15.2 Multiple instances
» 15.2.1 Use case
» 15.2.2 WLM setup
» 15.2.3 Running and monitoring
» 15.2.4 Tuning
» 15.2.5 Variations
»  16 Allocating CPU based on combination of CPU consumed and queue depth
» 16.1 Single instance vs. other workloads
» 16.1.1 Use case
» 16.1.2 WLM setup
» 16.1.3 Running and monitoring
» 16.1.4 Tuning
» 16.1.5 Variations
» 16.2 Multiple instances
» 16.2.1 Use case
» 16.2.2 WLM setup
» 16.2.3 Running and monitoring
» 16.2.4 Tuning
» 16.2.5 Variations
»  17 Tiered CPU allocation based on metric from default queue
» 17.1 Single instance vs other workloads
» 17.1.1 Use case
» 17.1.2 WLM setup
» 17.1.3 Running and monitoring
» 17.1.4 Tuning
» 17.1.5 Variations
» 17.2 Multiple instances
» 17.2.1 Use case
» 17.2.2 WLM setup
» 17.2.3 Running and monitoring
» 17.2.4 Tuning
» 17.2.5 Variations
»  18 Tiered CPU allocation based on metric from nondefault queue
» 18.1 Two instances
» 18.1.1 Use case
» 18.1.2 WLM setup
» 18.1.3 Running and monitoring
» 18.1.4 Tuning
» 18.1.5 Variations
»  19 Allocating CPU based on how busy the instance is
» 19.1 Single instance vs other workloads
» 19.1.1 Use case
» 19.1.2 WLM setup
» 19.1.3 Running and monitoring
» 19.1.4 Tuning
» 19.1.5 Variations
» 19.2 Multiple instances
» 19.2.1 Use case
» 19.2.2 WLM setup
» 19.2.3 Running and monitoring
» 19.2.4 Tuning
» 19.2.5 Variations
»  20 Cluster: Production servers across three machines
» 20.1 Single instance vs. other workloads
» 20.1.1 Use case
» 20.1.2 WLM setup
» 20.1.3 Running and monitoring
» 20.1.4 Tuning
» 20.1.5 Variations
»  21 Cluster: Test and development instances sharing servers
» 21.1 Single instance vs. other workloads
» 21.1.1 Use case
» 21.1.2 WLM setup
» 21.1.3 Running and monitoring
» 21.1.4 Tuning
» 21.1.5 Variations
»  22 References and links
» 22.1 HP-UX Workload Manager
» 22.2 BEA WebLogic Server
»  23 Copyrights, trademarks
»  Appendix A: Single Instance WLM and WebLogic configuration files
» A.1 WLM configuration files
» A.1.1 manual_cpucount.wlm
» A.1.2 wls_1inst_3level.wlm
» A.1.3 wls_2inst_3level.wlm
» A.1.4 wls_2queue_2inst.wlm
» A.1.5 wls_1inst_CPUusage.wlm
» A.1.6 wls_2inst_CPUusage.wlm
» A.1.7 wls_1inst_q_goal.wlm
» A.1.8 wls_2inst_q_goal.wlm
» A.1.9 wls_1inst_hybrid_qc.wlm
» A.1.10 wls_2inst_hybrid_qc.wlm
» A.2 wlmwlsdc property files
» A.2.1 instA_qbusy.props
» A.2.2 instA_qdepth.props
» A.2.3 instA_qdepth_hipri.props
» A.2.4 instB_qbusy.props
» A.2.5 instB_qdepth.props
»  Appendix B: Cluster WLM and WebLogic configuration files
» B.1 Production Cluster WLM configuration files
» B.1.1 clprod0.wlm
» B.1.2 clprod1.wlm
» B.1.3 clprod2.wlm
» B.2 Production Cluster wlmwlsdc property files
» B.2.1 prod0.props
» B.2.2 prod1.props
» B.2.3 prod2.props
» B.3 Test/Development Cluster WLM configuration files
» B.3.1 cltest0.wlm
» B.3.2 cltest1.wlm

1 Abstract

HP-UX Workload Manager (WLM) can help you manage and prioritize BEA WebLogic Server™ workloads. This paper demonstrates various management techniques. In particular, it:

  • Demonstrates example uses of WLM with WebLogic workloads, first with individual instances, then for clustered configurations
  • Provides a framework from which you can extend these concepts to other commercial J2EE application server workloads
  • Illustrates general WLM workload separation and management techniques outside the classic enterprise data center

2 Goal

After completing the integration, you will be able to use WLM to actively monitor a WebLogic instance, moving CPUs to or from the instance as needed to maintain acceptable performance, while also using less net CPU resources over time than an unmanaged instance would. This is a net win for you as the unused CPU resources can then be used for other computing tasks when the WebLogic instances do not require them.

3 Target audience

The discussion of use cases and management techniques should be accessible to most technical professionals with some UNIX background. The detailed information on applying changes to various configuration files may require previous knowledge of WebLogic Server and its associated terminology and administrative tools.

4 Abbreviations used

WLS
BEA's WebLogic Server
WLM
HP-UX Workload Manager
PRM
HP-UX Process Resource Manager
PSETs
HP-UX Processor Sets
FSS
HP-UX Fair Share Scheduler
VPars
HP-UX Virtual Partitions
JVM
Java Virtual Machine
MBean
JMX Management Bean
JMX
Java Management Extensions
wlmwlsdc
The Workload Manager WebLogic Server data collector utility
For more information on WebLogic Server terms, you can consult the WebLogic Server Glossary.

5 Workload requirements

The workload separation described here is largely aimed at CPU-bound workloads, or workloads that are contending for CPU resources. Although not covered in this paper, WLM can also control disk bandwidth and memory. Examples of those controls are described in other documentation. Also not covered here are workloads that are contending for, or limited by, network resources.

6 Security of the workloads

The workload-separation techniques described here are not substitutes for good security measures and isolation such as firewalls. If the workloads do not share the same level of trust, or have differing needs for user or system security, do not use WLM to combine them. WLM workload groups provide resource consumption separation; however, because the workloads share an HP-UX operating system instance, WLM does not provide the type of isolation offered by hardware partitions or systems separated by a firewall.

7 Platforms used for this paper

The WebLogic/WLM techniques outlined here were tested with the software revisions indicated in the table below.

Product Version Comment
HP-UX Workload Manager A.02.02 (Product B8843CA) The Workload Manger (WLM) product automatically controls the disk, memory, and CPU resources available to given tasks by automating features of Process Resource Manager (PRM), processor sets, and partitions.
BEA WebLogic Server 7.0 At the time of this writing, the most recent version of WebLogic Server is 7.0. This version was used in the preparation of this whitepaper. Other versions should work with similar techniques, but have not been tested.
HP-UX 11i V1.0 (B.11.11) Processor sets (also referred to as PROCSETS or PSETs) are used as workload containers. The PSET abilities of HP-UX 11i V1.0 (B.11.11) or HP-UX 11i V2.0 (B.11.23) are required for these to work. See your HP-UX release notes and Support Pack CD information on the www.hp.com/go/softwaredepot site for more information on processor sets for your platform.

8 Separating processes into WLM workload groups

To understand what tools we have at our disposal to separate and control workloads, this section provides a quick overview of WLM workload groups and separation. Much more information on the operation of WLM (and PRM, which provides some of WLM's functionality) can be found in the WLM User's Guide and the wlm(5) man page. These documents are available on systems with WLM installed. In addition, they are available through http://www.hp.com/go/wlm.


For information on how WebLogic processes equate to workloads, see the WebLogic Server layout. The processes are placed into workload groups whose resources are subject to allocations.


8.1 WLM overview

WLM controls workloads on HP-UX servers based on WLM workload groups. You define the workload groups and assign applications and users to the groups. WLM then adjusts the CPU allocations for the groups based on your defined service-level objectives (SLOs). WLM can also control memory and disk bandwidth allocations for the workload groups. (In the WLM context, a 'workload' is a group of HP-UX processes that jointly perform some work.)

WLM has two types of workload groups:

  • FSS workload groups
    With these groups, WLM uses the Fair Share Scheduler (FSS) to allocate CPU based on CPU time slices. A given FSS group is provided with a particular share of the CPU allocation across all CPUs in the system. This provides good resource sharing, as the CPU allocation is very fine, but provides very little isolation and limited CPU locality.

  • PSET workload groups
    WLM can use PSETs (processor sets) as the foundation for workload groups. For these groups, WLM manages the number of CPUs assigned to the underlying PSETs. A PSET offers its processes dedicated CPUs—no other processes on the system can access those CPUs.

WLM can also manage CPUs across either:

  • virtual partitions (vPars)

    or

  • nPartitions (nPars) that use Instant Capacity cores

vPars offer dedicated resources to their processes. In addition, a vPar has its own instance of the HP-UX operating system, providing OS isolation. nPars also offer dedicated resources and their own instances of HP-UX. In addition, nPars offer hardware isolation. With Instant Capacity, CPU resources are installed on a system but are not available for use until purchased. This feature allows you to buy a system that meets current needs but also provides a quick and efficient upgrade path.

With virtual partitions (vPars), WLM migrates CPUs between the vPars as their respective SLOs demand. Using nPars that have CPU resources managed by Instant Capacity software, WLM can deactivate CPU resources on one nPar and activate a purchased but inactive Instant Capacity core on another nPar that needs the CPU resource more. This pseudo-movement of CPUs ensures resources are available where they are needed without incurring the charge of purchasing more CPU resources.

To summarize, WLM can manage the items in the following table.

Item managed CPU is allocated in OS isolation Hardware isolation
FSS workload groups Ticks No No
PSET workload groups Whole CPUs No No
vPars Whole CPUs Yes No
nPars Whole CPUs Yes Yes

While FSS workload groups provide very flexible CPU allocation, they provide no OS or hardware isolation. Conversely, vPars and nPars offer more isolation, but CPU allocation is less flexible and administration overhead is increased.

8.2 WLM's separation mechanisms

WLM provides several methods to place processes in workload groups. It is important to understand these methods as they form the basis of our WebLogic workload separation methods. First, let's see how we define these workloads. The following snippet from a WLM configuration file creates three workload groups: servers_grp, wls_grp, and OTHERS.

	prm {
	    groups = OTHERS : 1,
		 servers_grp : 2,
		 wls_grp : PSET;
	}
    
Note that the FSS workload groups OTHERS and servers_grp are given a name and a number, while wls_grp, a group based on a PSET, is only given a name. For this type of group, WLM chooses the number. Later sections of the WLM configuration file then assign resource allocations to the groups. Processes within the groups then share the allocation for that group.

The following sections explore how processes are placed in defined workload groups.

8.2.1 Application records: workload separation by binary name

The first mechanism to separate workloads is an 'app record'. This simply names a particular application binary and the group in which it should be placed. For the WebLogic work, there are two variants of interest.

8.2.1.1 Separation by binary names

A full pathname (not a symlink) to an HP-UX binary can be given. For instance, here is an application record that acts on a named executable:
	prm {
	    groups = OTHERS : 1,
		 servers_grp : 2,
		 wls_grp : PSET;

	    apps = wls_grp : /opt/weblogic/bin/httpd ;
	}
    

The app record above causes the PRM application manager to place any newly running /opt/weblogic/bin/httpd executables into the group wls_grp, which is a dynamic PSET.

8.2.1.2 Separation by alternate names

If the program to be separated is actually a script that is executed by a separate interpreter, an 'alternate name' or 'alt_name' can be used, where the full path to the interpreter and the basename of the script are given. For instance, here is an application records that acts on a named /bin/sh script:
	prm {
	    groups = OTHERS : 1,
		 servers_grp : 2,
		 wls_grp : PSET;

	    # note that /bin/sh must appear in either
	    # /etc/shells or /opt/prm/shells for this to work
	    apps = wls_grp : /bin/sh startInstA.sh ;
	}
    

The app record above causes the PRM application manager to place any newly running /bin/sh script named startInstA.sh into the group wls_grp, which is a dynamic PSET. Note that for this to work, /bin/sh must appear in either /etc/shells or /opt/prm/shells. See the wlmconf(1M) man page for more information on alternate names.

NOTE on polling: It is important to realize that for either application name or alternate names, the process is not placed in the workload group at fork() time. Rather, the PRM application manager periodically polls for newly started processes that match app records. If it detects one or more matches, the processes are moved to their respective workload groups. For more information, see the application manager discussion in the WLM or PRM documentation.

8.2.2 User records: workload separation by process owner UID

Besides placing particular binaries into groups, you can place processes according to their owner's UID. User records provide this feature. Here is an example:
	prm {
	    groups = OTHERS : 1,
		     testers : 2,
		     coders : 3,
		     surfers : 4;

	    users = moe : coders surfers,
		    curly : coders surfers,
		    larry : testers surfers;
	}
       

Besides the default OTHERS group, this example has three groups of users: testers, coders, and surfers. The user records cause processes started by users moe and curly to be run in group coders by default, and user larry's processes to be run in group testers by default. Each user is also given permission to run jobs in group surfers if they wish, using the prmrun or prmmove commands mentioned below. Users not belonging to either group are placed in OTHERS by default.

For information on group permissions and precedence of user and app records, see the PRM and WLM documentation.

8.2.3 prmrun: starting a process in a workload group

Besides using app and user records to place processes into groups, you can explicitly start processes in particular groups. Given the group and user records described above, user larry running the command:
	    % my_really_big_job &
	
would cause his job to be run in group testers. However, running:
	    % prmrun -g surfers my_really_big_job &
	
would cause the process to be run in group surfers.

This has particular application to WebLogic, as it can be used to run httpd and its children directly in a group:

	    % prmrun -g wls_grp /opt/weblogic/bin/weblogicctl start
	
or Tomcat, in a similar fashion:
	    % prmrun -g wls_grp /opt/tomcat/bin/tomcat start
	

prmmove: moving an existing process to a workload group

Besides using prmrun to start new processes in particular groups, existing processes can be moved to a new group with the prmmove command. If larry from the above example has a job running with process ID (PID) 4065 running in group testers, he could move that process to group surfers by running the command:

	% prmmove surfers -p 4065
       

For WebLogic, which runs as a daemon and becomes the leader of its own process group, sweeping all members of httpd's process group into a workload group is quick and easy. Here we use the contents of the stored PID file to locate httpd's PID. Because httpd is a daemon, its PID is also its process group ID. We can sweep the process group into the workload group wls_grp as follows:

	% prmmove wls_grp -g `cat /opt/weblogic/logs/httpd.pid`
       

8.2.4 Default: inheriting workload group from parent process

If a process is not named by an explicit user or app record, or has not been started with prmrun or moved with prmmove, it simply starts and runs in the same group as its parent process. So for a setup like this:

	prm {
	    groups = OTHERS : 1,
		    mygrp : 2;
	}
       
if user root has an interactive shell running in group mygrp, any process spawned by that shell process would also run in group mygrp because its parent process was there. Simple inheritance is the mechanism that determines where most processes run, especially short-lived processes.

9 WLM workload and resource monitoring tools
There are a wide variety of tools available to help you monitor the process placement and resource allocation and use of your workloads.

  • prmmove(1M), prmrun(1M)
    tools to place processes in workload groups
  • ps(1) -R, ps(1) -P
    tools to see processes' current workload group
  • wlminfo(1M)
    command-line tool to monitor wlmd or wlmpard SLO status, metrics, and workload group allocation and usage
  • wlmgui(1M)
    graphical tool to monitor a single or multiple machines' WLM setup - see the cluster examples for example wlmgui(1M) screenshots.
Please see the WLM User's Guide or the commands' man pages for more information on the exact usage of these commands.

10 Overview of WebLogic concepts

The WebLogic web server is highly configurable and has a wealth of modifications, utilities, modules, and platforms available on the web.


10.1 Installing WebLogic Server

It is assumed that you have already installed the WebLogic Server software, so that will not be covered here. See the references section for a link to the WebLogic Server Installation Guide.

The examples assume WLS was installed at /opt/bea. If your instances are installed in a different location, see the $WL_HOME environment variable described in the wlmwlsdc(1M) man page section "posix_sh_setup_file" on how to modify this setting.


10.2 WebLogic Server workloads
10.2.1 WebLogic Server instance layout In this paper, we will discuss WebLogic workloads in terms of server 'instances', which are a single Java™ Virtual Machine (JVM) running WebLogic Server, often started by a parent shell script.

The individual instances can be part of three different WLS topologies:

  1. Single Server (Standalone Server)
  2. Admin Server with Managed Server(s)
  3. Admin Server with Clustered Managed Server(s)

In a Standalone Server setup, there is a single instance that performs admin and end-user work.

In the other two topologies, the administrative instance in the WebLogic domain is used for management while the Managed Server instances perform the bulk of the end-user application work and generally are the principal resource consumers. Hence, we are mainly concerned with the resource allocation to the Managed Server instances.


10.2.2 Figure: default WebLogic Server instance layoutAn example WebLogic Server instance is shown in the digram below. Inside the instance is one or more ExecuteQueue queues, with associated MBeans that can be used to monitor or control the queue.

The ExecuteQueue shown in the figure and the interaction of that and other queues with WLM is discussed in the metrics section.


wls_default.gif
10.2.3 Multiple-instance WLS configurations

As mentioned above, WLS instances, especially those for development or test, often run standalone. This means they are a single WLS instance in a single JVM. However, other instances may be part of a WebLogic 'cluster' of instances that serve a common purpose. Known as a WebLogic Server Cluster, multiple copies of the instance are run simultaneously to provide scalability and high availability for a given web application. A cluster appears to clients to be a single WebLogic Server instance.

More in-depth information on using clustering for scalability and high availability is available in WebLogic 7.0 - Using WebLogic Server Clusters.

Below is an example WebLogic domain with two managed instances running standalone and two instances that are clustered. In this case, Managed Server testA and Managed Server devB each serve individual functions and host separate applications. Clustered Managed Instances prodX and prodY together form Cluster prodcluster. As a cluster, they provide applications and services, acting like a single, higher capacity server instance.


wls_ex_domain.gif

Consult the WebLogic configuration documentation to learn more about these different server instance topologies.

For individual Managed Servers or for a Clustered Managed Server, WLM will monitor the instance and adjust the resources. WLM's management of the Servers is independent, allowing resources to be allocated among the Servers. Think of this as independent suspension on a vehicle—the springs may flex at slightly different times, but the net effect is to help the vehicle (or cluster) better handle bumps or dips.

We will start with a use case showing a simple WebLogic Server configuration and work our way up to cluster examples.

We will:

  1. show how to map a WebLogic workload's characteristics to a set of resource allocation use cases
  2. for the individual server use cases, give example configurations used by WLM to manage an individual standalone instance's resources
  3. show how to monitor the workload performance and resource consumption
  4. show how to develop variations on the individual server examples
  5. show how to use multiple copies of the standalone server examples to manage multiple servers and clusters

WLM's dynamic control of CPU resources for one or more WebLogic instances can help with the scalability of the application. However, WLM does not assist in high availability, as that requires multiple redundant hardware servers running multiple copies of the HP-UX operating system to avoid single points of failure, and WLM only controls resources within a single hardware server.

For high availability, consider using HP Serviceguard.


10.3 WebLogic Server environment setup and instance start
10.3.1 Start scripts: startWebLogic.sh & startManagedWebLogic.shIf you've used the WebLogic configuration wizard to create the instance workload, start scripts for the Administration Server and any Managed Servers have been created for you. These are generally named startWebLogic.sh and startManagedWebLogic.sh on HP-UX systems.

In addition to the scripts created at install time, many users create named scripts for individual instances, such as startProd0.sh to start an instance called prod0. These individual scripts may be copies of startWebLogic.sh or wrapper scripts that set variables and then invoke startWebLogic.sh. In either case, a start script with a unique name is required if you wish to use app records to place the WebLogic instances in workload groups. See the section on app records or the wlmconf(1M) man page for more information on placing scripts into workload groups.

More information can be found in the "Starting and Stopping WebLogic Servers" section of the WebLogic Server Administrative Guide. The guide also describes start scripts and the Java Virtual Machine (JVM) arguments.

10.3.2 POSIX sh environment setup files: setEnv.sh For wizard-created instance start scripts, the common settings are stored in a separate POSIX shell configuration file, usually named setEnv.sh which resides in the same directory as the start scripts. The setEnv.sh and related files are important if WebLogic is installed somewhere besides /opt/bea or if the instance is using custom JVM arguments, or a JVM other than the one supplied with WebLogic.

Direct use of this setEnv.sh script or a similar script as a data collector argument is covered in the wlmwlsdc section below.


10.4 Monitoring and managing the WebLogic instance

10.4.1 WebLogic Server command-line tools

There are a set of command-line uses of the weblogic.Admin class that may be useful for the administrator to do a quick check of an instance's availability, confirm usernames and passwords, or even load some queue-related metrics.

For instance, this command


	$JAVA_HOME/bin/java \
		-classpath $WL_HOME/server/lib/weblogic.jar \
		weblogic.Admin \
		-url t3://myhost.mydomain.com:7001 \
		-username system \
		-password weblogic \
		get -pretty \
		-mbean 'instAdomain:Location=admin,Name=default,ServerRuntime=admin,Type=ExecuteQueueRuntime'
	
is handy to check an instance's state, and confirm the correct username, password, administrative URL, and the instance's port number. For the example above, instAdomain is the domain name of the target instance. Common environment variable settings for the $JAVA_HOME would be a path such as /opt/bea/jdk1.3, and $WL_HOME would be a path such as /opt/bea/weblogic700.

Consult the WebLogic Server 7.0 Server Introduction: "Management and Monitoring" and related documents for more information. A list of references is included at the end of this document.

10.4.2 WebLogic Server Console

As most WebLogic users are already aware, WebLogic Server comes with a powerful web-based console. This is useful for a host of tasks and will be referenced for some monitoring tasks later in this document.

Consult the WebLogic Server 7.0 Server Introduction: "Management and Monitoring" and related documents for more information. A list of document pointers and references is included at the end of this document.


11 WebLogic Server metrics to use with WLM

11.1 WLS queues When Enterprise Java Bean (EJB) requests are submitted to a given WebLogic instance, it is actually placed in a queue of work, referred to as an execute queue. This queue is serviced by a pool of work threads. The default queue for a given instance has the unsurprising name of 'default', and generally is configured with roughly 15 threads, a few of which are consumed by system functions. To quote the WebLogic Tuning Guide:

By default, a new WebLogic Server instance is configured with a default execute queue (named "default") that contains 15 threads, which are used by all applications running on the server instance. A WebLogic Server instance also contains two built-in execute queues named __weblogic_admin_html_queue and __weblogic_admin_rmi_queue, but these queues are reserved for communicating with the Administration Console. If you configure no additional execute queues, all Web applications and RMI objects use the default queue.

See the "Execute Queue —> Configuration" help text for more information on configuring queues and thread pools. Also, see the "Using Execute Queues to Control Thread Usage" section of the WebLogic Server Performance and Tuning Guide for more information on queues, thread pools, and why and how to configure new queues in an instance.

Note that each queue (and most other instance features) have Management Beans (MBeans) associated with them that are used by the management tools to monitor and control instance components.

11.2 WLS queue metrics We will use two metrics to estimate an instance's need for more or fewer resources. These metrics are:

queue_depth
MBean parameter based on: PendingRequestCurrentCount

idle_thread_count
MBean parameter based on: ExecuteThreadCurrentIdleCount

In general, if a given queue has idle threads waiting for work, then it has enough CPU. If it has several idle threads, then it may have more CPU than it needs. Conversely, if there are no idle threads and there is a nonzero queue_depth, there is work waiting to be done and more CPU resources may be useful to the instance.

For a given work queue, there can be either idle threads or a nonzero queue depth, but not both at once. As mentioned later in the wlmwlsdc discussion, we will be using a third metric, queue_busy, which is a combination of the idle_thread_count and queue_depth metrics. This combination lets us see idle threads as queue_busy < 0, and items on the queue as queue_busy > 0.

12 How to use the WLS metrics with WLM
With the exception of a few built-in metrics like CPU usage, WLM must be provided application-specific performance data to evaluate how the application is doing. The performance data must be fresh, accurate, efficient to collect, and indicate resource needs. WLM uses that data stream to evaluate how successful previous allocation changes were and decide what changes to make in the future. The metrics are provided by data collectors, which have application-specific knowledge, both what metrics to fetch and how to fetch them.

12.1 Metric collection: wlmwlsdc

WLM comes with a number of data collectors that are dedicated to collecting a certain type of data. The data collector for WLS metrics is wlmwlsdc.

12.1.1 Metrics available through wlmwlsdc

The data collector wlmwlsdc returns the metrics listed below.

Metric name Definition Formula or source Parameters
queue_depth instance PendingRequestCurrentCount metric queue_depth = ExecuteQueueRuntime MBean PendingRequestCurrentCount, fetched via JMX none
idle_thread_count JMX ExecuteThreadCurrentIdleCount metric idle_thread_count = ExecuteQueueRuntime MBean ExecuteThreadCurrentIdleCount, fetched via JMX none
queue_busy synthetic metric to express queue_depth and idle_thread_count in one metric; metric is positive when the ExecuteQueue has items in it (queue_depth nonzero) and negative when the ExecuteQueue has idle threads (idle_thread_count nonzero) queue_busy = (C1 * queue_depth) - (C2 * idle_thread_count) C1 = com.hp.wrm.tk.weblogic.queue_depth_multiplier, default 1.0
C2 = com.hp.wrm.tk.weblogic.idle_thread_multiplier, default 1.0

The queue_busy metric is a synthetic metric calculated from two WebLogic internal metrics. For many SLOs, this combination is more useful than either metric alone—with a single metric it provides information about whether the instance has extra threads available (idle_thread_count) or more work than the threads can currently process simultaneously (queue_depth). This combination metric allows similar SLOs to be written with fewer input metrics, using fewer external data collector processes than collecting queue_depth and idle_thread_count separately.

12.1.2 wlmwlsdc usage

The data collector wlmwlsdc monitors selected WLS instance execution queue metrics. wlmwlsdc outputs a stream of metrics to stdout, and any errors to stderr. The user can make trial runs of the data collector from the command line, and then use the same command line inside a WLM configuration file.

Here is how the command looks if run from the command line:


	% /opt/wlm/toolkits/weblogic/bin/wlmwlsdc \
	    my_instance_props.properties
	
The single argument my_instance_props.properties to wlmwlsdc is a Java properties file specifying the WebLogic instance-specific data such as URL, username, password, and metric collection frequency.

If the location of WLS or the JVM is nonstandard, the command can be run with a second argument like this:


	% /opt/wlm/toolkits/weblogic/bin/wlmwlsdc \
	    /home/work/my_instance_props.properties \
	    /home/work/bea/weblogic700/server/bin/setWLSEnv.sh
	
The second argument is a posix-sh script that is used to set the environment variables related to WLS and Java.

Within a WLM configuration file, the same data collector invocation would be done like this:


	#
	# Send stdout to wlmrcvdc (and on to wlmd) and stderr to syslog.
	#
	tune my_metric {
	    coll_argv =
		wlmrcvdc
		    wlmwlsdc \
			/home/work/my_instance_props.properties \
			/home/work/bea/weblogic700/server/bin/setWLSEnv.sh
	    ;
	    coll_stderr = syslog;
	}
	

The coll_stderr statement sends stderr for wlmwlsdc to syslog.

12.1.3 wlmwlsdc properties

You can set numerous properties to be used by wlmwlsdc as it collects metrics. Set these properties, which are described in the table below, in a file given on your wlmwlsdc invocation line, as shown in the previous section.

Parameter name data type Definition default source default value
com.hp.wrm.tk.wlm_metric string name of the wlm_metric - mainly useful for debugging and error messages $WLM_METRIC_NAME environment variable, if set, otherwise wlmwlsdc defaults $WLM_METRIC_NAME environment variable, if set, otherwise "unknown"
com.hp.wrm.tk.iterations int the number of measurements to perform before exiting, with the special value -1 meaning run forever wlmwlsdc defaults -1
com.hp.wrm.tk.interval int how long to sleep between measurements $WLM_INTERVAL environment variable, if set $WLM_INTERVAL environment variable, if set, otherwise wlmwlsdc defaults
com.hp.wrm.tk.debug integer debug level wlmwlsdc defaults 0
com.hp.wrm.tk.weblogic.instance string name of the target WebLogic instance wlmwlsdc defaults "admin"
com.hp.wrm.tk.weblogic.queue string name of the target WebLogic queue wlmwlsdc defaults "default"
com.hp.wrm.tk.weblogic.username string username with which to connect to instance wlmwlsdc defaults "system"
com.hp.wrm.tk.weblogic.url string URL with which to connect to instance wlmwlsdc defaults "t3://localhost:7001"
com.hp.wrm.tk.weblogic.password string password with which to connect to instance wlmwlsdc defaults "weblogic"
com.hp.wrm.tk.weblogic.queue_metric string metric to return to wlmd wlmwlsdc defaults "queue_busy"
com.hp.wrm.tk.weblogic.queue_depth_multiplier double used in queue_busy computation wlmwlsdc defaults 1.0
com.hp.wrm.tk.weblogic.idle_thread_multiplier double used in queue_busy computation wlmwlsdc defaults 1.0

12.1.4 wlmwlsdc POSIX environment variable scripts

To correctly execute the Java code and use the correct weblogic.jar file to match the workload instance, the wlmwlsdc utility must know the location of the JVM, the weblogic.jar, and any special JVM arguments required to correctly use the underlying JMX MBean classes.

However, these same requirements exist for a given WebLogic instance, and are conventionally solved by the instance executing a simple POSIX sh script before its JVM is invoked. This is usually named setEnv.sh and is executed by the instance startWebLogic.sh or startManagedWebLogic.sh script.

Environment Variable Explanation Default value
$JAVA_HOME Specifies the home directory of the Java Virtual Machine to run ($JAVA_HOME/bin/java); set this variable to the same value that is used for the WebLogic Server instance /opt/java1.3
$WL_HOME Specifies the home directory of the weblogic.jar file to use ($WL_HOME/server/lib/weblogic.jar); set this variable to the same value that is used for the WebLogic Server instance /opt/bea/weblogic700
$JAVA_OPTIONS Specifies Java command-line options that are to be passed directly as arguments to the JVM started (via exec()) by wlmwlsdc '' (null)
$JAVA_VM Specifies the mode (either -server or -client) in which the JVM is to run; this variable is passed directly as an argument to the JVM started (via exec()) by wlmwlsdc '' (null)

If any of the settings for the instance do not match the defaults in the table above, then a file containing the correct environment variable settings must be provided as a second argument:


	% /opt/wlm/toolkits/weblogic/bin/wlmwlsdc \
	    my.props \
	    my_env_vars.sh
	
Normally, these settings are identical to those in the setEnv.sh file that the instance would use. Assuming that, why not just use the setEnv file directly? Well, you can. However, there may be security implications, as the three following approaches describe.
12.1.4.1 Run instance setEnv.sh script directly as root This is the simplest method and the method illustrated in the example WLM and WebLogic configuration files. The wlmwlsdc process is run as root and uses the setEnv.sh script directly. For many users this will be sufficient. For others, this will not be acceptable as their setEnv.sh file is not owned by root or a trusted user.
12.1.4.1.1 Benefit: simplicity
This is very easy to understand, implement, and maintain.

Also, if the instance is updated or other environment variable settings are changed, the wlmwlsdc monitoring the instance will use the new settings.

12.1.4.1.2 Drawback: executing file as root
Security warning! setWLSEnv.sh will be run by wlmd, which runs as UNIX user root. You must closely manage the file permissions and file contents to prevent security problems.

12.1.4.2 Run instance setEnv.sh script directly as nonroot

The wlmwlsdc command can be run as a nonroot user by wlmd. The wlmrcvdc(1M) command used by wlmd to handle the communications with the data collector can run the data collector as a different user. This requires some extra configuration steps for instance process and data collector process placement, but may be preferred when the instance setEnv.sh script is writable by a nontrusted user.

Here's how you'd modify an existing example WLM configuration file to run setEnv.sh as a user other than root. As an example we'll use wls_2inst_q_goal and assume the WLS instance is normally run by a UNIX user 'wladmin'. This means we'd like to also run wlmwlsdc as the user 'wladmin' (instead of root):

  1. Modify the wlmrcvdc lines, adding -u wladmin

    A coll_argv line like the following would accomplish that:

    
    	    tune wls.default.queue_busy {
    	      coll_argv =
    		  wlmrcvdc -u wladmin
    		      /opt/wlm/toolkits/weblogic/bin/wlmwlsdc
    			/opt/wlm/toolkits/weblogic/config/instA_qbusy.props
    			/opt/bea/domains/testdomain/setEnv.sh
    		;
    
    	      # smooth out the peaks and valleys in this metric stream
    	      cntl_smooth = 0.5 ;
    
    	      # send data collector errors to syslog
    	      coll_stderr = syslog ;
    	    }
    	    
    This will cause wlmwlsdc to be run as user 'wladmin'.

  2. Add app records for wlmwlsdc.
    By default, nonroot owner processes will be migrated by WLM to the group OTHERS or to the user's default group. However, we need to keep the wlmwlsdc data collector processes in the PRM_SYS group, along with wlmd, to isolate them from any resource shortages. We do that by writing a specific app record to place them in the special group PRM_SYS. See below for the configuration file text.

  3. Add PRM_SYS to the PRM groups list
    WLM requires that any groups mentioned in app or user records be explicitly listed in the groups statement. After adding that, the whole prm structure looks like this:
    
    	    prm {
    		groups =
    			PRM_SYS : 0,
    			OTHERS : 1,
    			wls1_grp : PSET,
    			wls2_grp : PSET
    		;
    
    		apps =
    		    PRM_SYS  : /bin/sh wlmwlsdc
    		;
    
    		users = wladmin: OTHERS wls1_grp wls2_grp ;
    	    }
    	    
Now after starting WLM, you should see the wlmwlsdc Java process running as user wladmin.
12.1.4.2.1 Benefit: secure, reuses existing setEnv.sh file
Because wlmwlsdc> is not run by root, the execution of setEnv.sh does not give access to root permissions, avoiding security issues.

Also, if the instance is updated with custom environment settings in its setEnv.sh file, the wlmwlsdc command monitoring the instance will automatically use the new settings.

12.1.4.2.2 Drawback: more complicated WLM configuration file
The use of user records to place instances into workload groups will move any processes owned by that user, even if they're data collectors instead of end-user workloads. This should not be done without adding app records to put the data collectors back into PRM_SYS. During low resource conditions, it is important that the data collectors still have CPU resources to run, and keeping them in PRM_SYS with wlmd is the best way to assure these resources are available.

12.1.4.3 Run root-owned copy of instance setEnv.sh script as root

A third option is to make a custom file, perhaps based on a copy of setEnv.sh and any files it pulls in, that is owned by root and writable by no other users. This file can contain the environment variables that wlmwlsdc needs to find the custom WL_HOME or JAVA_HOME locations. For instance, a file such as /opt/bea/domains/mydomain/wlmwlsdc_env.sh could be used to hold the wlmwlsdc environment variables settings.
12.1.4.3.1 Bene