Azure Functions - 限制并行执行 [英] Azure Functions - Limiting parallel execution

查看:32
本文介绍了Azure Functions - 限制并行执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以限制并行运行的最大函数数?

Is it possible to limit the maximum number of Functions that run in parallel?

我阅读了文档并发现了这个:

I read the documentation and came across this:

当多个触发事件的发生速度快于单线程函数运行时的处理速度时,运行时可能会并行多次调用该函数.

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.

如果函数应用正在使用 Consumption 托管计划,则函数应用可以自动横向扩展.函数应用的每个实例,无论是在消费托管计划还是常规应用服务托管计划上运行的应用,都可能使用多个线程并行处理并发函数调用.

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

我在具有事件中心输入绑定的应用服务计划中使用函数,并且我的函数应用程序中只有一个函数.如果我不能限制它,有没有人知道这种设置的最大并发函数调用数是多少?

I am using a Function on an App Service plan with an Event Hub input binding and only have a single Function within my Function App. If I can't limit it, does anyone know what the maximum number of concurrent function invocations will be for this kind of setup?

推荐答案

没有办法为事件中心触发的函数指定最大并发数,但您可以控制批处理大小和获取选项,如 此处描述.

There isn't a way to specify a maximum concurrency for Event Hubs triggered functions, but you can control batch size and fetching options as described here.

最大并发调用数也可能因您的工作负载和资源利用率而异.

The maximum number of concurrent invocations may also vary depending on your workload and resource utilization.

如果需要并发限制,这是(当前)您需要处理的事情,以下帖子讨论了一些您可能会觉得有用的模式:

If concurrency limits are needed, this is (currently) something you'd need to handle, and the following posts discuss some patterns you may find useful:

在 Azure Function App 中限制 Azure 存储队列处理

限制 Azure Functions 上的并发作业数排队

这篇关于Azure Functions - 限制并行执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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