How do I turn on “always-on” for an Azure Function?

前端 未结 3 1951
慢半拍i
慢半拍i 2020-12-06 04:09

I have a Function App with 3 functions, one of them timer-triggered every 2 minutes. I observed that after a while, the function stops being triggered, but restarts when I g

相关标签:
3条回答
  • 2020-12-06 04:44

    This answer applies to all Azure Function scenarios with the exception of those that are triggered by an http request.

    There are 3 cases to look at:

    1. You have a Function App running in a Free/Shared App Service Plan: Always On is not available, and those scenarios are simply not supported.
    2. You have a Function App running in a Basic/Standard/Premium App Service Plan: Always On is available and can be turned on. In fact it is on by default, and you'll get a warning in the Functions UI if you turn it off.
    3. You have a Function App using a Consumption Plan: there is no need for Always On as the system takes care of waking up your functions whenever they need to run. This is the recommended approach for most users.
    0 讨论(0)
  • 2020-12-06 05:01

    Azure Functions are managed together by Azure App Service which restricts always on to modes that are Basic or above (no free or shared)

    In Basic or Standard mode, you can enable Always On to keep the app loaded all the time.

    0 讨论(0)
  • 2020-12-06 05:02

    You can do a small hack if you're in free/shared app service plan & it works perfectly. Use the pinging service like freshping.io that pings your function url every 5 secs/custom interval which prevents your app from being idle. Freshping.io gives you 5 free urls to ping.

    Note: pinging url doesn't count towards the CPU run time, unless you ping the actual function. So it doesn't affect your time limit.

    Hope this helps.

    0 讨论(0)
提交回复
热议问题