Limit number of tasks running in parallel in Server


Is it possible to limit the number of tasks that are running in parallel in Server? In order to not saturate the RAM in the case there are multiple tasks executed almost simultaneously. For example, let’s say we have 5 tasks:

Task A
Task B
Task C
Task D
Task E

And we want maximum 2 tasks running in parallel. Let’s say Task A and Task B and triggered, and they both start running. If Task C has been triggered and Task A and Task B are still running, then Task C waits until either Task A or Task B finishes in order to start.

It would be a first-come, first-serve strategy but respecting a maximum number of parallel tasks.



P.D - regarding launching the same task multiple times in parallel, is this available in EasyMorph Server?

It’s not possible to limit the number of tasks that are running in parallel. However, it’s possible to make one or more tasks wait until another task finishes performing a resource-consuming operation using the “Exclusive access” action.

The action ensures that only one task consumes a resource (in our case it’s memory). When multiple tasks use the “Exclusive access” action, they all start as usual, but when one of them starts using the resource, others wait until it finishes. Just make sure that all the tasks describe the resource in the action using the same keyword (e.g. “memory”).

The action won’t give you a degree of parallelism more than 1, though. So if you need to have max two tasks running simultaneously, you will need to split your tasks into 2 groups and use different resource names in each group, e.g. “memory1” in one group, and “memory2” in the other.

Not yet. It will be available in version 5.0.

1 Like