DB2 Version 10.1 for Linux, UNIX, and Windows

Enabling and setting CPU shares

Enable the CPU shares attributes by setting the value of the wlm_disp_cpu_shares database manager configuration parameter to YES. Set the hard or soft CPU shares attribute using the CREATE SERVICE CLASS or ALTER SERVICE CLASS statement. You will generally want to set hard CPU shares on service classes running low-priority or high-impact work, and soft CPU shares on high-priority service classes when CPU resources are strained.

Before you begin

Note: For the CPU shares setting to be effective, you must enable the workload management dispatcher by configuring the wlm_dispatcher database manager configuration parameter. This can be done either before or after you have enabled and set the CPU shares. See: Enabling workload management dispatcher.

About this task

The CPU shares attributes are enabled in this task by using the command line processor method, and the CPU shares attribute is set for a service class by using the CREATE SERVICE CLASS or ALTER SERVICE CLASS statement.

Restrictions

You can assign soft CPU shares only to service classes that the workload management dispatcher can control, which are user and maintenance service classes. The CPU resource allocations for system service classes cannot be controlled by the workload management dispatcher.

Procedure

Skip to step 2 if the CPU shares attributes have already been enabled.

To enable the CPU shares attributes:

  1. Using the command line processor (CLP), issue the UPDATE DATABASE MANAGER CONFIGURATION (or UPDATE DBM CFG) command and set the value of the wlm_disp_cpu_shares database manager configuration parameter to YES; the parameter value is updated immediately by first attaching to your DB2 instance:
    attach to instance-name
    update dbm cfg using wlm_disp_cpu_shares yes
    detach

Skip to step 3 if an existing service class hard or soft CPU shares setting is to be altered.

To create a new service class and set the hard or soft CPU shares attribute:

  1. Issue the CREATE SERVICE CLASS statement to create a new service class and set the hard or soft CPU shares value to 5000 in this example:
    • create service class service-class-name hard cpu shares 5000
    • create service class service-class-name soft cpu shares 5000

To alter the hard or soft CPU shares setting for an existing service class:

  1. Issue the ALTER SERVICE CLASS statement to alter the hard or soft CPU shares value to 15000 in this example:
    • alter service class service-class-name hard cpu shares 15000
    • alter service class service-class-name soft cpu shares 15000

Results

The CPU shares attributes have been enabled and you have set or altered the hard or soft CPU shares setting for the specified service class. Service classes assigned hard CPU shares can, under restricted conditions, claim CPU resources that other service classes have relinquished due to their lessened workload demand. Service classes assigned soft CPU shares, on the other hand, can always claim CPU resources that other service classes have relinquished due to their lessened workload demand.

What to do next

After having enabled the workload management dispatcher to manage CPU resources, having enabled the CPU shares attributes, and set the hard or soft CPU shares attribute, consider completing the following tasks: