Setting a CPU limit

Set a CPU limit at the database level by using the wlm_cpu_limit configuration parameter. Set a CPU limit for a service class by using the CPU LIMIT clause of the CREATE SERVICE CLASS or ALTER SERVICE CLASS statements. Set CPU limits to cap the CPU used by a database or service class under all circumstances during workload management dispatcher control.

Before you begin

You must enable the workload management dispatcher by configuring the wlm_dispatcher database manager configuration parameter, if not already done. By enabling the workload management dispatcher, CPU resource control using the CPU limit attribute becomes available by default. See: Enabling the workload management dispatcher.

About this task

The CPU limit is set in this task by using the command line processor.

Restrictions

At the service class level, you can assign CPU limits 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

To set CPU limits at the database level (skip to step 2 to set CPU limits at the service class level):

  1. Set the wlm_cpu_limit configuration parameter. For example, to set the CPU limit to 75% on database-1, and 25% on database-2, issue the following commands:
    connect to database-1
    update db cfg using WLM_CPU_LIMIT 75 
    terminate
    connect to database-2
    update db cfg using WLM_CPU_LIMIT 25
    terminate

To create a new service class and set the CPU limit (skip to step 3 if an existing service class CPU limit setting is to be altered):

  1. Issue the CREATE SERVICE CLASS statement to create a new service class and set the CPU limit to 25% in this example:
    create service class service-class-name cpu limit 25

To alter the CPU limit setting for an existing service class:

  1. Issue the ALTER SERVICE CLASS statement to alter the CPU limit to 50% in this example:
    alter service class service-class-name cpu limit 50

Results

You have set or altered the CPU limit setting for the specified databases or service classes, or both. The workload management dispatcher will not allocate CPU resources to these service classes or databases beyond the set limit.

What to do next

Set the dispatch concurrency level by configuring the wlm_disp_concur database manager configuration parameter. See: Setting dispatch concurrency level.