Parallel for each limit

There are situations where launching same job in parallel in 10 processes speeds up things, but launching in 20 parallel processes will go slower than one by one.

So, it would be useful to have a property to the Parallel For Each activity to limit to a number maximum processes, having in this way an automatic slicing of the work to be done to smaller batches.

Hey Ciprian,

I agree, this would be useful. In the interim, I was wondering if having a multidimensional collection would work? So you have an array of strings for instance that you’d like to go through, then you could cut it up into a number of arrays that you want to be processed in parallel and then feed an array of those arrays to the Parallel For Each. You’d then have to have an inner For Each that’s not parallel, but it may get the job done. That workaround is a lot of effort though and your suggestion would be far more efficient.

1 Like

I have already worked this way (other technology, other times) checking how many CPUs are free and dividing the queue in smaller queues to go in parallel to occupy all CPUs, but it is additional work and it could be made more simple with the limit proposed :slight_smile:

1 Like

Thank you for your suggestion. I added it to our internal ideas tracker for our team to consider.

1 Like