RamblingCookieMonster / Invoke-Parallel

Speed up PowerShell with simplified multithreading
MIT License
384 stars 88 forks source link

Invoke-Parallel skips processing some objects when throttle > 1 #68

Open VickyWinner opened 5 years ago

VickyWinner commented 5 years ago

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

sheldonhull commented 5 years ago

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?

amolsp777 commented 4 years ago

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.