[英]Azure Functions: Function started lag time on App Service plan
We are experiencing a performance issue on Azure functions under load where there is a lag time between the call to the Azure function and the code in the function executing. We are experiencing a performance issue on Azure functions under load where there is a lag time between the call to the Azure function and the code in the function executing.
The first log entry for the Azure function call in Application insights says:应用程序洞察中 Azure function 调用的第一个日志条目说:
Function started (Id=6e2a7c0e-7190-4f4b-a146-9b957b49f4aa)
After that there is a random lag of a few seconds before the first log from our code which is the first line of code in our function.在那之后,在我们的代码的第一个日志之前有几秒钟的随机延迟,这是我们 function 中的第一行代码。
We are only seeing this lag on load.我们只看到这种负载滞后。
The Function App is running under an App Service plan with a premium pricing tier. Function 应用程序在具有高级定价层的应用程序服务计划下运行。 The functions are all HTTP triggers.
函数都是HTTP触发器。
Any ideas why this could be happening and what the "Function started" log means?任何想法为什么会发生这种情况以及“功能启动”日志的含义是什么?
This is a common "problem" known as cold start:这是一个常见的“问题”,称为冷启动:
a cold start is an increase in latency for Functions which haven't been called recently.
冷启动是最近未调用的函数的延迟增加。
You can find a full explanation about it in here: https://azure.microsoft.com/en-au/blog/understanding-serverless-cold-start/您可以在此处找到有关它的完整说明: https://azure.microsoft.com/en-au/blog/understanding-serverless-cold-start/
In case it's not accepted for your business, you should upgrade to premium plan where the instances are perpetually warmed.如果您的业务不接受它,您应该升级到永久加热实例的高级计划。 More info about it in here: https://docs.microsoft.com/en-us/azure/azure-functions/functions-premium-plan
更多信息在这里: https://docs.microsoft.com/en-us/azure/azure-functions/functions-premium-plan
It's a cold start like Thiago says, and if you thing startup time for a .NET app is bad, you should try a Node function!就像 Thiago 所说的那样,这是一个冷启动,如果您认为 .NET 应用程序的启动时间不好,您应该尝试使用 Node 功能!
To eliminate this you can set "Always On" to "On" by going to Configuration -> General Settings on the App Service in the portal.要消除此问题,您可以通过在门户中的应用服务上转到配置 -> 常规设置将“始终开启”设置为“开启”。 You need a Basic or higher tier in your App Service Plan, which it looks like you already have.
你的应用服务计划中需要一个基本或更高的层级,看起来你已经拥有了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.