问题描述
我有一个由 Azure 服务总线队列触发的 Azure Function - Azure Function App 托管在消费计划中.
I have an Azure Function triggered by Azure Service Bus queue - Azure Function App is hosted in consumption plan.
队列中出现新消息时,最多需要多长时间才能唤醒 Azure Function?(假设过去 20 分钟内没有消息).
How long does it take at most to wake up an Azure Function when new message in queue appears? (assuming there were no message during past 20 minutes).
它是否在任何地方指定?我在 文档 中发现:
Is it specified anywhere? I've found in the Documentation that:
对于非 HTTP 触发器,新实例最多每 30 秒分配一次.
For non-HTTP triggers, new instances will only be allocated at most once every 30 seconds.
这是否意味着我无法在 30 秒内更快地处理队列中的第一条消息?
Does it mean that I won't be able to process the first message in the queue faster than within 30 seconds?
将计时器触发的 Azure 函数添加到同一个函数应用程序(连同触发的服务总线)是否有助于保持 Azure 函数实例正常运行?
Will adding Timer Triggered Azure Function to the same Function App (along with Service Bus triggered) help to keep the Azure Function instance up and running ?
推荐答案
首先,在使用消费计划并且闲置20分钟左右时,函数应用进入闲置状态.然后如果你使用该功能,你会遇到冷启动,这需要花费一些时间该起床了.
First of all, when using consumption plan and idle for about 20 minutes, the function app goes into idle. And then if you use the function, you will experience cold start, which needs to take some time to wake up.
对于您的问题:
这是否意味着我将无法处理排队速度超过 30 秒?
Does it mean that I won't be able to process the first message in the queue faster than within 30 seconds?
这取决于以下(链接是 这里):
It depends on following(link is here):
1.你正在使用哪种语言(例如,使用c#的函数比java更快),以下是从上面的链接中提取的:
1.which language you're using(eg. function using c# is more faster than java), the following is picked up from the link above:
典型的冷启动延迟时间为 2 到 15 秒.C# 函数通常在 3 秒内完成启动,而 JavaScript 和 Java 的尾巴更长.
2.你的函数中依赖的数量:
2.The number of dependencies in your function:
添加依赖项从而增加部署的包大小将进一步增加冷启动持续时间.
会将计时器触发的 Azure 函数添加到同一个函数应用程序(连同触发的服务总线)有助于保持 Azure 功能实例启动并运行?
will adding Timer Triggered Azure Function to the same Function App (along with Service Bus triggered) help to keep the Azure Function instance up and running ?
是的,将 Timer Triggered azure 函数添加到同一个函数应用程序将使其他函数应用程序保持预热(启动并运行).
Yes, add a Timer Triggered azure function to the same function app would keep the others warm up(up and running).
这篇关于《醒来》Service Bus Queue 触发 Azure Function 的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!