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
Are any of your API calls possible to run in an expression rule? It sounds like (but i can't tell exactly because you haven't included too much context / screenshots / etc) you're running multiple subsequent / branching / looping calls that could potentially be run sequentially with grouping and conditionality (for increased efficiency) within one or more expression rules...
For instance, one call that determines whether some subsequent ones even need to be run, instead of being put in multiple process nodes, could potentially be loaded as local variables in a single expression rule, which could potentially simplify your process structure by quite a bit, and at least decrease your chaining burden, even if the total time consumed for the actual calls to run stays about the same.
Yes, I can run all the apis in this critical part in an expression rule. The input to the rule is an array, Each item can run in parallel. For each item in the array, 1,2 or 3 different threads can be spawned, these need to run sequentially. Each of these sub threads run 2 or 3 apis. All of this is handled pretty much, an api call is made only when necessary.
Peter Lewis , can you help us to better understand how to decouple looping code aiding in automatic parallel execution?
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.