Azure(耐用)功能-管理并行性 [英] Azure (Durable) Functions - Managing parallelism

查看:64
本文介绍了Azure(耐用)功能-管理并行性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在发布此问题,以查看我是否正确理解了Azure Functions(尤其是持久函数)中的并行性.

I'm posting this question to see if I'm understanding parallelism in Azure Functions correctly, and particularly Durable Functions.

最近使用az cli将设置最大并行度的功能添加到Azure Functions中: https://github.com/Azure/azure-functions-host/issues/1207

The ability to set max degree of parallelism was recently added to Azure Functions using az cli: https://github.com/Azure/azure-functions-host/issues/1207

az resource update --resource-type Microsoft.Web/sites -g <resource_group> -n <function_app_name>/config/web --set properties.functionAppScaleLimit=<scale_limit>

我已将此功能应用到我的Function App中,但是我不确定这是如何与耐用功能的MaxConcurrentOrchestratorFunctions和MaxConcurrentActivityFunctions设置一起使用的.

I've applied this to my Function App, but what I'm unsure of is how this plays with the MaxConcurrentOrchestratorFunctions and MaxConcurrentActivityFunctions settings for Durable Functions.

以下内容是否会导致250个并发活动函数的全局最大值?

Would the below lead to a global max of 250 concurrent activity functions?

  • functionAppScaleLimit:5
  • MaxConcurrentOrchestrator函数:5
  • MaxConcurrentActivityFunctions:10

推荐答案

引用您共享的链接

Referring to the link you shared to limit scaling this functionAppScaleLimit will help you to specify the maximum number of instances for your function. Now coming to MaxConcurrentOrchestratorFunctions : sets the maximum number of orchestrator functions that can be processed concurrently on a single host instance and MaxConcurrentActivityFunctions the maximum number of activity functions that can be processed concurrently on a single host instance. Refer to this

现在,我正在解释MaxConcurrentOrchestratorFunctions的作用,这将帮助您了解其工作原理:

Now, I am explaining what MaxConcurrentOrchestratorFunctions does , which would help you understand how it works:

MaxConcurrentOrchestratorFunctions 控制在任何给定时间可以将多少个Orchestrator函数加载到内存中.如果将并发设置为1,然后启动10个协调器功能,则一次仅将一个加载到内存中.请记住,如果协调器函数调用活动函数,则该协调器函数将在等待响应时从内存中卸载.在这段时间内,另一个协调器功能可能会启动.这样做的结果是,您将有多达10个以交错方式运行的协调器函数,但实际上一次仅应执行1个.

MaxConcurrentOrchestratorFunctions controls how many orchestrator functions can be loaded into memory at any given time. If you set concurrency to 1 and then start 10 orchestrator functions, only one will be loaded in memory at a time. Remember that if an orchestrator function calls an activity function, the orchestrator function will unload from memory while it waits for a response. During this time, another orchestrator function may start. The effect is that you will have as many as 10 orchestrator functions running in an interleaved way, but only 1 should actually be executing code at a time.

此功能的目的是限制协调器代码使用的CPU和内存.它对于实现任何类型的单例模式都不会有用.如果要限制活动业务流程的数量,则需要实现此功能.

The motivation for this feature is to limit CPU and memory used by orchestrator code. It's not going to be useful for implementing any kind of singleton pattern. If you want to limit the number of active orchestrations, then you will need to implement this.

这篇关于Azure(耐用)功能-管理并行性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆