Tuesday 1 March 2016

Office 365 - Workflow Performance


A - OBJECTIVE: 

- Online workflow services provided by Office 365 have some drawbacks in terms of performance & resources.

- We will aim to address all workflow performance in this post.

B - PROBLEMS :

PROBLEM
1: infinite loop


1. Error Message: The runtime has detected an infinite loop in the instance after allowing 30000 milliseconds of CPU without an idle point.




2. Reason: 
- Loop is done repeatedly while indexItem is less than countItems. Based on the test, If the counteItems is less than 200, it works fine till the end. However, if it's larger than 200, normally the instance is suspended.



- When the runtime detects such kind of loop, which has high consumption of CPU and memory, it will suspend the instance. 

- The limitation is controlled by a complicated formula which depends on multi-dimension factors, such as CPU consumption, memory consumption, workflow complexity, etc.


- Such limitation exists to ensure high performance of workflow service and prevent attach and malicious code.


3. Solution: 

- If the Workflow is complex and redesigning it is not an option, as a short term fix, it is best to leverage the Pausing capabilities, of the Workflow. It is simple but can keep the Workflow, from getting throttled. 

- Pause for Duration or Pause Until Date can simplify this design. For this case, you may process 100 items then pause the instance for a while (i.e. 15 mins).


4. Source Code:


No comments:

Post a Comment