I am running some processing in parallel that includes api calls.The result with then populate an interface attended by a user.
I have tried both a!forEach and MNI but for both the performance is not as expected.
By looking at the performance tab in the expression rule, it is clear that the items in the array are running sequentially and not in parallel,
as the total time for the expression rule is the sum of every iteration. As a test I tried to put only a GET api call in the foreach loop and the result is the same.
This is not what I was expecting, is there anything that can be done to enforce the threads to run in parallel to optimize the performance?
Discussion posts and replies are publicly visible
It looks like you mostly tried various approaches, but my recommendation is,Parallel gateways with subprocess nodes means using a process model where an AND gateway splits the process flow into multiple parallel paths, each containing a subprocess node that calls a separate process model to handle one API call. All subprocess nodes execute concurrently, then an AND gateway converges the paths back together when all subprocesses complete.
Thank you Shubham,
I have not tried that yet. The problems I have with that approach though is that:
1) I do not know beforehand exactly how many items are in the initial array (could be 20, could be 70). I think this would mean designing 70 parallel processes and have them test whether there is an occurrence in the array that matches that?
2) That would definitely break chaining, I would like to preserve it.
You’re right - In this case parallel gateways won’t work because you’d need to pre-design 70 paths with bounds checking and it breaks result chaining. Your multiple if statement approach is better for this case.