简体   繁体   中英

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.

The first log entry for the Azure function call in Application insights says:

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.

We are only seeing this lag on load.

The Function App is running under an App Service plan with a premium pricing tier. The functions are all HTTP triggers.

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/

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

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!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM