Enabling and setting CPU shares
Enable and set CPU shares to manage CPU resources, by using shares-based entitlements that are assigned to service classes and databases.
Before you begin
About this task
This task uses the command line processor.
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 for services classes attribute by using the CREATE SERVICE CLASS or ALTER SERVICE CLASS statement.
Set the hard or soft CPU shares for databases by using the wlm_cpu_shares and wlm_cpu_share_mode database configuration parameters.
- Set hard CPU shares on service classes and databases that are running low-priority or high-impact work.
- Set soft CPU shares on high-priority service classes and databases when CPU resources are strained.
If you are using multiple databases, set the CPU shares at the database level, so that your preferred CPU resource distribution happens between databases.
Restrictions
You can assign CPU shares 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.
For users of Db2 11.5.5 and earlier, CPU Shares are not supported in an environment where WLM Admission Control is enabled. WLM Admission Control is enabled when the database manager configuration parameter wlm_admission_ctrl is set to YES.
Procedure
Skip to step 2 if the CPU shares attributes are already enabled.
To enable the CPU shares attributes:
To set the hard or soft CPU shares attribute at the database level:
Skip to step 4 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:
To alter the hard or soft CPU shares setting for an existing service class:
Results
The CPU shares attributes are enabled and you have set or altered the hard or soft CPU shares setting for the specified service class. Service classes and databases that assigned hard CPU shares can, under restricted conditions, claim CPU resources that other service classes and databases relinquish due to their lessened workload demand. However, service classes and databases that are assigned soft CPU shares, can always claim CPU resources that other service classes and databases relinquish due to their lessened workload demand.
What to do next
- For the hard or soft CPU shares setting to be effective, you must enable the workload management dispatcher by configuring the wlm_dispatcher database manager configuration parameter. See: Enabling the workload management dispatcher.
- Set the dispatch concurrency level by configuring the wlm_disp_concur database manager configuration parameter. See: Setting dispatch concurrency level.
- Create or alter a service class and configure the CPU limit by using the CREATE SERVICE CLASS or ALTER SERVICE CLASS statement. See: Setting a CPU limit.
- Set the minimum CPU utilization percentage for the workload management dispatcher to consider service classes to be active by configuring the wlm_disp_min_util database manager configuration parameter. See: Setting minimum CPU resource utilization for service class to be considered active.