Example: Determining the priority of activities based on what data is estimated to be accessed

The following example shows how to create a work class set that determines the processing priority of activities based on the data that is estimated to be accessed.

A user can assign a tag to data by specifying a data tag when creating or altering a tablespace or storage group. That data tag can then be used to determine the processing priority of a DML activity.

Assume you have already tagged your high priority data with a data tag value of 1, your medium priority data with a data tag value 4 and your low priority data with a data tag value of 9 by setting the DATA TAG value in the appropriate table spaces. Now, you want any DML activity that might touch high priority data (i.e. data that you have already tagged with a data tag value of 1) to be run in a high priority service subclass. You also want any DML activity that is estimated to touch medium priority data to be run in a medium priority service subclass and any DML activity that is estimated to touch low priority data to be run in a low priority service subclass. You also only want to allow 5 DML activities that are estimated to touch the low priority data to run concurrently and any additional activities should be queued.

To set up a work class set containing work classes that identify DML activities that might touch data that you have deemed low priority, do the following:

  1. Create a work class set containing work classes that will isolate out the DML activities based on an estimate of which data the activities will access.
       CREATE WORK CLASS SET WCS (
             WORK CLASS WC_HIGH WORK TYPE DML DATA TAG LIST CONTAINS 1, 
             WORK CLASS WC_MED WORK TYPE DML DATA TAG LIST CONTAINS 4, 
             WORK CLASS WC_LOW WORK TYPE DML DATA TAG LIST CONTAINS 9) 
  2. Create a work action set containing work actions that will map the activities assigned to the WC_HIGH work class to a high priority service subclass, activities assigned to the WC_MED work class to a medium priority service subclass, and activities assigned to the WC_LOW work class to a low priority service subclass.
        CREATE WORK ACTION SET MAINWAS FOR SERVICE CLASS MAINSC USING WORK CLASS SET WCS (
              WORK ACTION MAP_HIGH ON WORK CLASS WC_HIGH MAP ACTIVITY TO SCHIGH, 
              WORK ACTION MAP_MED ON WORK CLASS WC_MED MAP ACTIVITY TO SCMED, 
              WORK ACTION MAP_LOW ON WORK CLASS WC_LOW MAP ACTIVITY TO SCLOW)
  3. Create a concurrency threshold limiting the maximum number of concurrent activities touching lower priority data to 5 with all other activities getting queued until one of the 5 currently running activities completes.
        CREATE THRESHOLD THLOWPRI FOR SERVICE CLASS SCLOW UNDER MAINSC ENFORCEMENT DATABASE 
            WHEN CONCURRENTDBCOORDACTIVITIES > 5 CONTINUE

In this example, if an activity is estimated to access data with a data tag value of 1, 4 and 9, the activity is assigned to WC_HIGH because WC_HIGH is first in the evaluation order. To map the activity to WC_LOW, you will have to change the evaluation order and put WC_LOW ahead of WC_MED and WC_HIGH.