Invoke-Parallel icon indicating copy to clipboard operation
Invoke-Parallel copied to clipboard

Invoke-Parallel skips processing some objects when throttle > 1

Open VickyWinner opened this issue 5 years ago • 2 comments

I am processing large objects and I would like Invoke-Parallel to push 1000 threads at a time. The job is done for only 400+ objects. But when I change the throttle to 1, all the objects are processed. Is there any MAX for throttle?

$all = Get-Content $TextFilePath $a = Invoke-Parallel -InputObject $all -throttle 1000 -ImportVariables -EA SilentlyContinue -runspaceTimeout 30 -ScriptBlock

VickyWinner avatar Jul 12 '19 17:07 VickyWinner

The code example would mean 1000 throttle would be 1000 running at the same time, so if you have 400 it would do them simultaneously?

sheldonhull avatar Jul 13 '19 02:07 sheldonhull

I am also facing similar issue. I am trying to fetch servers information using scriptblock and give InputObject as 1000 around servers. It is working fine but at the end in output some time it gives me Output for 600 and sometimes 400. Not sure how Throttle and RunspaceTimeout combination works.

$RUNParallel = Invoke-Parallel -InputObject $Servers -Throttle 15 -RunspaceTimeout 70 -ScriptBlock $ServerCheckBlock

If we use Throttle as 1 then it is as similar as ForEach Loop one by one.

amolsp777 avatar Feb 06 '20 18:02 amolsp777