-
Notifications
You must be signed in to change notification settings - Fork 54
Description
Hi,
Trying with the default durable functions templates (from the portal) to achieve parallel processing/scaling as per article.
In the fan out/fan in pattern, you execute multiple functions in parallel and then wait for all functions to finish.
However it seems that the Activity Function is queuing up..
Orchestrator Function:
run.ps1
param($Context) $output = @() $inputs = @('tokyo','london','berlin') $ParallelTasks = foreach ($input in $inputs) { Invoke-ActivityFunction -FunctionName 'Hello2' -Input $input -NoWait } $output = Wait-ActivityFunction -Task $ParallelTasks $output
function.json
{ "bindings": [ { "name": "Context", "type": "orchestrationTrigger", "direction": "in" } ] }
Activity Function (Hello2):
run.ps1
param($name) write-host "$name .. sleep" start-sleep -seconds 10 "Hello $name!"
Function.json
{ "bindings": [ { "name": "name", "type": "activityTrigger", "direction": "in" } ] }
Activity Output:
2021-03-11T21:50:34.303 [Information] Executing 'Functions.Hello2' (Reason='(null)', Id=6f5ab392-4818-417b-8515-12f2b69218cb)
2021-03-11T21:50:34.303 [Information] Executing 'Functions.Hello2' (Reason='(null)', Id=e1580f91-129b-44f6-a0da-28cb2c786560)
2021-03-11T21:50:34.306 [Warning] Your function 'Hello2' is queuing requests as there are no available runspaces. You may be able to increase your throughput by following the best practices on https://aka.ms/functions-powershell-concurrency.
2021-03-11T21:50:34.308 [Information] Executing 'Functions.Hello2' (Reason='(null)', Id=61afd729-3415-496a-b6fb-8a7df3d39a60)
2021-03-11T21:50:34.310 [Information] INFORMATION: berlin .. sleep
2021-03-11T21:50:44.311 [Information] OUTPUT: Hello berlin!
2021-03-11T21:50:44.317 [Information] Executed 'Functions.Hello2' (Succeeded, Id=e1580f91-129b-44f6-a0da-28cb2c786560, Duration=10014ms)
2021-03-11T21:50:44.325 [Warning] Your function 'Hello2' is queuing requests as there are no available runspaces. You may be able to increase your throughput by following the best practices on https://aka.ms/functions-powershell-concurrency.
2021-03-11T21:50:44.326 [Information] INFORMATION: tokyo .. sleep
2021-03-11T21:50:54.339 [Information] OUTPUT: Hello tokyo!
2021-03-11T21:50:54.347 [Information] Executed 'Functions.Hello2' (Succeeded, Id=6f5ab392-4818-417b-8515-12f2b69218cb, Duration=20047ms)
2021-03-11T21:50:54.349 [Information] INFORMATION: london .. sleep
2021-03-11T21:51:04.354 [Information] OUTPUT: Hello london!
2021-03-11T21:51:04.355 [Information] Executed 'Functions.Hello2' (Succeeded, Id=61afd729-3415-496a-b6fb-8a7df3d39a60, Duration=30047ms)
Concurrency
Depending on your use case, Durable Functions may significantly improve scalability. To learn more, see Durable Functions application patterns. (back to link article)