Managing performance with the asynchronous API

The asynchronous API can result in a large number of concurrent tasks within a CICS® system. CICS will automatically begin workload management in case a region reaches MXT, and you can regulate performance yourself using TRANCLASS. Transaction tracking and statistics are also available to monitor the performance of regions running asynchronous workloads.

Regulating performance

Using the TRANCLASS resource

By specifying the TRANCLASS of parent transactions, you can control the maximum number of parent tasks that will run in a system at any given time, and by extension the number of child tasks that will be created by those parents.

Use the MAXACTIVE attribute of TRANCLASS to ensure that the combined number of parent and child transactions is less than the MXT for your system. The MAXACTIVE value for your child tasks should be higher than the MAXACTIVE value for parent tasks, assuming that a given parent task will create multiple children.

Important: If you do choose to set TRANCLASS for your child transactions, don't use the same TRANCLASS for child transactions and parent transactions, otherwise you can end up with a system full of parent tasks and no space for child tasks to attach
Automatic regulation by CICS system management

If a region becomes overloaded, CICS will automatically start regulating workflow to prevent too many child tasks being created. Parent tasks issuing a RUN TRANSID command will be suspended and using the ASPARENT wait type put in a queue, and resumed when workload levels in the region drop.

When parent tasks are resumed, workload in the region may fluctuate, and parent tasks may be suspended and resumed in quick succession. This is the expected behavior, and indicates that automatic system management is properly protecting CICS from excessive asynchronous requests.

If your asynchronous workload is regularly causing problems for your region, consider regulating workload using TRANCLASS as described above.

Monitoring performance

Using previous transaction tracking

Previous transaction data characteristics allow you to track the relationships between tasks in your region. For example, if one of your child tasks is hanging, you can use this data to see which parent task is waiting for a response from that child, and make a decision about how to resolve the problem.

Using statistics and monitoring data

Asynchronous services statistics and Monitoring field data are available to help you monitor and diagnose asynchronous workloads. You can find out how many RUN TRANSID and FETCH commands were issued by an application, how much time was spent waiting for child tasks to complete, and other useful information to help monitor and improve asynchronous performance.

Using CICS policies

You can also use CICS policies to manage asynchronous workload. Using the Async requests rule type, you can choose a threshold for how many RUN TRANSID commands can be issued before the policy action is initiated. Using CICS policies, you can gain even finer control over the parent and child tasks in your system.

Example: Two Async requests task rules

Figure 1. Definition of the rule async_over_3
This is a screen capture of the rule definition of the async_over_3 rule.
In this example, the async_over_3 rule specifies that if a task issues more than three RUN TRANSID commands, CICS will issue message DFHMP3001.
DFHMP3001 13/03/2017 16:11:36 IYCWZCAB Task 00238(PAS2) exceeded a policy threshold. 
BundleId=asyncPolicy, PolicyName=asynctask, RuleName=async_over_3, RuleType=asyncrequest, 
Category=runtransid, Threshold=3 (Value=3, Unit=), CurrentCount=4.
Figure 2. Definition of the rule async_over_1k
This is a screen capture of the rule definition of the async_over_1k rule.

The async_over_1k rule, on the other hand, will abend a task if the task issues more than a thousand RUN TRANSID commands. CICS will issue message DFHMP3002 along with the abend code AMPB. Abends caused as a result of policy rules can be handled just like any other abend.

DFHMP3002 13/03/2017 16:11:36 IYCWZCAB Task 00238(PAS2) exceeded a policy threshold and is abended with abend code AMPB. 
BundleId=asyncPolicy, PolicyName=asynctask, RuleName=async_over_1k, RuleType=asyncrequest, Category=runtransid, 
Threshold=1000 (Value=1, Unit=K), CurrentCount=1001.