0 votes
2.4k views
in Client-Side Human Services by (120 points)
How to perform few activities in parallel within the Human service to improve performance like auditing and emailing after close of task and fetching data before load of coach. We are having performance issue in CSHS.

1 Answer

0 votes
ago by (30.6k points)

A client-side human service is single-threaded from the user's point of view, but the server work it triggers does not have to block the page. Three patterns, in the order they pay off:

1. Fire-and-forget after the task (audit, e-mail): do not put them in the human service at all. Model them in the BPD after the activity as system tasks on a parallel path, or send an event message (UCA) from the last step of the CSHS and let a small system process do the work. The task closes immediately; the BPD does the rest.

// service flow "Notify" started asynchronously from the CSHS: exposed as "startable" and called through the REST API from the coach
POST /rest/bpm/wle/v1/service/{serviceId}?action=start&createTask=false&parts=none&params={"taskId":"1234"}
// or: tw.system.startProcessByName("Post task actions", inputs)  from a service flow (returns at once, the BPD runs on its own)

2. Parallel data loading before the coach: split the "fetch data" service into independent service flows and call them from the coach with several UI Toolkit Service Call controls (or Data controls) with Auto run - the browser issues the Ajax calls concurrently and the coach renders while they return. Show a busy indicator on the sections that wait.

// coach load: run three lookups in parallel, render when all are back
var pending = 3, done = function () { if (--pending === 0) ${Spinner}.setVisible(false); };
${GetCustomer}.execute(); ${GetOrders}.execute(); ${GetLimits}.execute();   // each Service Call's "on result" calls done()

3. Parallel steps inside a service flow: a service flow runs sequentially, but you can start other service flows asynchronously with tw.system.startProcessByName (BPD) or have the BPD use a parallel gateway with several system tasks; results are joined by the gateway. For pure Java work, a Java integration can use an executor internally.

Also check the usual causes of slow coaches first: large lists bound to tables (page them), services called in the coach's load instead of before it, and repeated findUserByName / LDAP calls (cache).

References

Related questions

0 votes
1 answer 3.4k views
0 votes
1 answer 1.4k views
0 votes
1 answer 1.7k views
0 votes
1 answer 1.6k views
0 votes
1 answer 2.1k views

723 questions

807 answers

98 comments

4.9k users

Join BPM Community Discord Channel

Welcome to BPM Tips Q&A, Community wiki/forum where you can ask questions and receive answers from other IBM BPM experts and members of the community. Users with 2000 points will automatically be promoted to expert level.
Created by Dosvak LLC
Our Youtube Channel
...