是否可以限制并行运行的函数的最大数量?
我阅读了文档并发现了这一点:
When multiple triggering events occur faster than a single-threaded function runtime can process them, the runtime may invoke the function multiple times in parallel.
If a function app is using the Consumption hosting plan, the function app could scale out automatically. Each instance of the function app, whether the app runs on the Consumption hosting plan or a regular App Service hosting plan, might process concurrent function invocations in parallel using multiple threads.
The maximum number of concurrent function invocations in each function app instance varies based on the type of trigger being used as well as the resources used by other functions within the function app.
https://learn.microsoft.com/en-gb/azure/azure-functions/functions-reference#parallel-execution
我在具有事件中心输入绑定(bind)的应用服务计划上使用函数,并且我的函数应用程序中只有一个函数。如果我不能限制它,有谁知道这种设置的并发函数调用的最大数量是多少?
最佳答案
无法指定事件中心触发函数的最大并发数,但您可以控制批量大小和获取选项,如 described here .
并发调用的最大数量也可能会有所不同,具体取决于您的工作负载和资源利用率。
如果需要并发限制,这是(当前)您需要处理的事情,以下帖子讨论了您可能会发现有用的一些模式:
Throttling Azure Storage Queue processing in Azure Function App
Limiting the number of concurrent jobs on Azure Functions queue
关于Azure Functions - 限制并行执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44257660/