Settings
The Settings tab allows you to configure and manage Instance Threshold Policies on a workflow in your environment. Instance Threshold Policies help prevent looping and recursive workflows from entering a loop state and causing server performance degradation.
You can set Instance Threshold Policies on the K2 server at workflow server level, meaning all workflows in your environment follow one policy. See Workflow Server Settings for more information.
The Instance Threshold Policy contains two options, Workflow Instances and Step Instances.
- The Workflow Instances option allows you to configure a policy setting that, if a certain amount of workflow instances are started within a certain amount of time (in minutes), then any new instances are put into error state.
- The Step Instances option allows you to configure a policy setting that, if a certain amount of steps are executed within a workflow instance within a certain amount of time (in minutes), then that workflow instance is put into error state.
Permissions
To configure a policy at a workflow level, you need to have administrator rights on the workflow.
Follow the steps below to configure a Instance Threshold Policy.
- Open K2 Management and select the workflow in the Workflow Server node.
- On the Process Details page, click the Settings tab.
- By default, workflows inherit Instance Threshold Policy settings from the Workflows node's Settings tab. You can disable this by unchecking the Use Workflow Server Settings setting. For the purpose of this example, the Use Workflow Settings check box is deselected.
- Configure the Workflow Instances and Step Instances options.
- Note that changes you make to these options are automatically saved.
- For the purpose of this example, the Workflow Instances option is set to 3 instances in 1 minute.
- When the workflow breaks the policy, new instances are placed into error state . For the purpose of this example, a Leave Request Workflow is used. The workflow exceeded the Workflow Instances option of the policy and the instance that exceeded the policy goes into error state. The first three instances executed successfully but the fourth instance went in to error state as per the policy.
- To view a detailed description of the error, you can view it in the Errors > All node or in the Errors tab on the Process Details page of the workflow. The following error is displayed:
Workflow process instance threshold exceeded. Too many workflow instances were started based on your policy. - If a Step Instance option of a policy is exceeded, you can see the error in the Errors > All node or in the Errors tab on the Process Details page of the workflow. The following error is displayed:
Workflow step instance threshold exceeded. Too many workflow steps were started based on your policy.
- Instance threshold policies do not check your workflow logic for exit conditions. If you have configured loop steps intentionally in your workflow that will violate a policy at runtime, the workflow instance is forced into an error state.
- After enabling an instance threshold policy, any existing workflows instances continue to run. Any new workflow instances that get started which exceed the default policy settings are forced into an state.
- In scenarios where you have multiple, load-balanced servers, instance threshold policies are shared with all servers in the farm. However, the policies are enforced per server.
- In a scenario where Call Sub Workflow (IPC) steps start new instances on multiple servers, the steps start new instances until the threshold is reached on server one. Any new instances that get started on server one go into error state. Any new instances that start on server two (which has not exceeded the threshold policy setting) are processed until server two's threshold policy is exceeded.