How to best handle multiple WorkItems in a parallel way?

97 views Asked by At

Two questions about the amount of parallel WorkItems you can run using Forge.

  1. We have one AppBundle with one Activity. How many WorkItems can we start in parallel? Is there a limitation? E.g.: We start WorkItem1 and WorkItem2. Will WorkItem2 be put on a queue until WorkItem1 is finished, or will WorkItem2 start simultaneously with WorkItem1?

  2. And what if we want to handle multiple WorkItem in Parallel, what would be the best solution? Do we need to use multiple Activities (e.g. WorkItem1 is started with Activity1, and WorkItem2 is started with Activity2, etc...). Or do we need to register multiple AppBundles to spread the workload?

1

There are 1 answers

3
Michal Vasicek On

We have one AppBundle with one Activity. How many WorkItems can we start in parallel? Is there a limitation? E.g.: We start WorkItem1 and WorkItem2. Will WorkItem2 be put on a queue until WorkItem1 is finished, or will WorkItem2 start simultaneously with WorkItem1?

There is no limitation. You can schedule how many you need. They will be processed in parallel based on the worker's pool capacity.

And what if we want to handle multiple WorkItem in Parallel, what would be the best solution? Do we need to use multiple Activities (e.g. WorkItem1 is started with Activity1, and WorkItem2 is started with Activity2, etc...). Or do we need to register multiple AppBundles to spread the workload?

You can use 1 activity with 1 appbundle only. Activity is something like "function definition" in a regular programming language. You are defining your 1 function, and how many time you call it in parallel is up to you. Each created workitem has it own ID you can use to track the progress and pick the results of the workitem processing.