Azure Functions - 限制并行执行
Azure Functions - Limiting parallel execution
是否可以限制 运行 并行的 Function 的最大数量?
我阅读了文档并发现了这个:
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://docs.microsoft.com/en-gb/azure/azure-functions/functions-reference#parallel-execution
我在带有事件中心输入绑定的应用服务计划上使用一个函数,但我的函数应用中只有一个函数。如果我不能限制它,有谁知道这种设置的最大并发函数调用数是多少?
无法为事件中心触发的函数指定最大并发数,但您可以控制批处理大小和提取选项,如 described here。
并发调用的最大数量也可能因您的工作负载和资源利用率而异。
如果需要并发限制,这是(目前)您需要处理的事情,以下帖子讨论了一些您可能会觉得有用的模式:
仅供参考,我在搜索节流时遇到了这里。您可以在函数上使用 [Singleton]
属性,确保一次只执行一个。也许不是您真正想要的和非常严格的节流方式,但它仍然是一种选择。
https://docs.microsoft.com/en-us/azure/app-service/webjobs-sdk-how-to#singleton-attribute
微软添加了一个新的设置,可以用来限制函数执行的并发。该设置为 WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT
,可用于限制并行执行的函数实例数。但是,根据 Microsoft 的说法,它尚未完全实施。
https://github.com/Azure/azure-functions-host/wiki/Configuration-Settings
对于那些仍然感兴趣的人:
https://docs.microsoft.com/en-us/azure/azure-functions/event-driven-scaling#limit-scale-out
有一种方法可以通过设置functionAppScaleLimit
参数来限制并行执行的数量。
是否可以限制 运行 并行的 Function 的最大数量?
我阅读了文档并发现了这个:
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://docs.microsoft.com/en-gb/azure/azure-functions/functions-reference#parallel-execution
我在带有事件中心输入绑定的应用服务计划上使用一个函数,但我的函数应用中只有一个函数。如果我不能限制它,有谁知道这种设置的最大并发函数调用数是多少?
无法为事件中心触发的函数指定最大并发数,但您可以控制批处理大小和提取选项,如 described here。
并发调用的最大数量也可能因您的工作负载和资源利用率而异。
如果需要并发限制,这是(目前)您需要处理的事情,以下帖子讨论了一些您可能会觉得有用的模式:
仅供参考,我在搜索节流时遇到了这里。您可以在函数上使用 [Singleton]
属性,确保一次只执行一个。也许不是您真正想要的和非常严格的节流方式,但它仍然是一种选择。
https://docs.microsoft.com/en-us/azure/app-service/webjobs-sdk-how-to#singleton-attribute
微软添加了一个新的设置,可以用来限制函数执行的并发。该设置为 WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT
,可用于限制并行执行的函数实例数。但是,根据 Microsoft 的说法,它尚未完全实施。
https://github.com/Azure/azure-functions-host/wiki/Configuration-Settings
对于那些仍然感兴趣的人: https://docs.microsoft.com/en-us/azure/azure-functions/event-driven-scaling#limit-scale-out
有一种方法可以通过设置functionAppScaleLimit
参数来限制并行执行的数量。