in Db2 v11.1 on Linux I would like to have control over applications that consumes too much CPU resources. For every application that consumes too much CPU for more then 3 seconds I want to lower CPU resources to max 5%.
In Db2 Workload Manager I created two subclasses. First without restrictions and second with 5%-CPU restriction. The trouble I have now is at "create threshold" command (bellow). CPUTIMEINSC actually means time spend in sub-class, but I am looking for option to only trigger threshold when SQL consumes a lot of CPU power.
How to restrict CPU consumption to "aggressive" applications?
-- Create super-class. CREATE SERVICE CLASS SC_APPS; -- Create default subclass that all applications start with. CREATE SERVICE CLASS SC_APPS_100 UNDER SC_APPS SOFT CPU SHARES 1000 CPU LIMIT 100 PREFETCH PRIORITY DEFAULT BUFFERPOOL PRIORITY DEFAULT; -- Create subclass with CPU, disk I/O and memory restrictions. CREATE SERVICE CLASS SC_APPS_05 UNDER SC_APPS HARD CPU SHARES 50 CPU LIMIT 5 PREFETCH PRIORITY LOW BUFFERPOOL PRIORITY LOW; -- Move application that consumes CPU for more then 3 seconds from non-restricting subclass to resource restricting subclass CREATE THRESHOLD TR_APPS_GOTO_05 FOR SERVICE CLASS SC_APPS_100 UNDER SC_APPS ACTIVITIES ENFORCEMENT MEMBER WHEN CPUTIMEINSC > 3 HOURS CHECKING EVERY 1 SECOND REMAP ACTIVITY TO SC_APPS_05; -- Crete workload restrictions for one user only CREATE WORKLOAD WL_APPS_05 SYSTEM_USER ('USER1') SERVICE CLASS SC_APPS_05 UNDER SC_APPS; -- Grant access to public GRANT USAGE ON WORKLOAD WL_APPS_05 TO PUBLIC;