Optimizing Performance of Workflow TaskList
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. These process attribute values can then be retrieved using the getprocessattribute() function as shown below.
fetchtable tasklist;
loop at table tasklist
set tasklist-additional_var1 =
getprocessattribute(tasklist-job_id, 'ATTR1');
endloop
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 parameter Workflow.processAttributesCacheSize in UFSSetup.properties; this parameter 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.