I am implementing a more advanced WLM configuration using multiple superclasses with multiple subclasses under each one. To make things work the way I want, I have to use CPU shares to enforce proper allocation of CPU across all these service classes... but I confess to being confused about how to go about this.
How do I figure out what number of shares to give to a superclass versus one of its subclasses and how do I know what the net effect will be?
The allocation of CPU based on CPU shares follows a tiered approach:
First, the overall CPU available to DB2 is allocated between all active superclasses based on their CPU shares
Second, the CPU allocated per each superclass is then sub-allocated across all its active subclasses based on their CPU shares
- And, yes, the default subclasses are considered in the latter step (assuming they meet the active criteria).
So the CPU shares allocated to service superclass affect the first order CPU allocation calculations at the superclass level but are not relevant when doing the allocation calculation for subclasses within the superclass; these are two different calculations and the shares allocated between a superclass and its subclasses do not have to be consistent or related in any way.
For example, I can allocate 10 shares at the superclass level and 10000 at the subclass level. They don't have be consistent as they don't have any relationship with each other, they are only releavnt when compared to their peers (i.e. superclass to superclass and subclass to subclass under the same superclass).
As alway, don't forget a couple of key things about CPU allocation with shares:
- To participate in CPU allocation, a service class (of any type) needs to have enough active processingto reach a CPU utilization if 5% or higher in order to have the service class shares considered in the overall calculation otherwise it is not considered for the calculation.
- These calculations are not static and are constantly re-evaluated so the actual allocations and service class participation can change constantly
If you want to get an idea of how the CPU is actually being allocated while your workload is active, you can run a query against the MON_SAMPLE_SERVICE_CLASS_METRICS function like this :
SELECT SUBSTR(SERVICE_SUPERCLASS_NAME,1,32) AS SUPER_NAME,
SUBSTR(SERVICE_SUBCLASS_NAME,1,32) AS SUB_NAME,
DECIMAL(ESTIMATED_CPU_ENTITLEMENT,5,2) AS ENTITLEMENT,
CPU_LIMIT AS LIMIT, DECIMAL(CPU_UTILIZATION,5,2) AS CPU
ORDER BY SUPER_NAME, SUB_NAME DESC
Hope this helps!