Optimizing Performance of Workflow TaskList
Optimizing
TaskList performance
Caching
of process attribute values
See also: Workflow Index, Workflow Out of the Box Tools
This document provides a technique to ensure the best possible performance for a workflow task list application. The following factors influence the performance of the task list:
The most significant negative influence on task list performance is the inclusion of additional information to be displayed to the user e.g. the following should be avoided wherever possible:
fetchtable
tasklist;
loop at table tasklist
fetch additional_data; // for each task,
fetch additional information from a database
set
tasklist-additional_var1 = additional_data_var1;
endloop
The inclusion of the fetch statement can add a large overhead e.g. the fetchtable tasklist statement will typically return up to 500 tasks in less than 2 seconds. But 500 additional database fetches can easily add another 5 seconds or more to the overall response.
To ensure optimal performance, it is recommended that any such “additional information” that is to be displayed to the user should be maintained as a process attribute within the appropriate workflow job. For best performance, include the process attribute as a substitutable value within the workflow task text e.g. Service request &&RequestNumber from &&RequestUser. If this is not possible, then process attribute values can be retrieved using the FPL getprocessattribute() function as shown below, or Javascript system.workflow.api.getProcessAttributeValue() method.
fetchtable
tasklist;
loop at table tasklist
set
tasklist-additional_var1 = getprocessattribute(tasklist-job_id, 'ATTR1');
endloop
A Workflow Maintenance scheduled task is provided to remove completed jobs from the workflow runtime database. This should be run periodically to stop the workflow database from growing too large.
The system ensures a fast response for the getprocessattribute() function by caching process attribute values for running jobs. The size of the process attribute cache can be configured using server property Process Attributes Cache Size; this property sets the maximum number of jobs held in the cache and has a default value of 2000. Setting this value to -1 disables the cache. The cache size should be set with care: if process attributes are used in the task list display as described above, caching will have a major impact on task list performance so the cache should be large enough to accommodate all active workflow jobs. However, setting the cache size too large can use excessive memory.