0

When a developer pushes an update to their Functions codebase, does the runtime stop all active instances in a Function app (hosted as a premium plan) and then update them all and finally restart them? Or is the update rolled out to the instances one by one as in stop-update-restart a single instance and move on to the next one in the queue?

user246392
  • 2,661
  • 11
  • 54
  • 96

1 Answers1

0

When you deploy the function update code from local to azure, there are two steps. First is update the code and second is restart the function app. Here is what I test in my side:

I have two functions in one function app(with premium plan), named Function1 and Function2. The code in two functions are almost same shown as below screenshots. enter image description here

enter image description here

Now request the url of the two functions to trigger them(first trigger Function1 and then trigger Function2, interval of 1 second). They will print the logs like below screenshot(from 1 to 79): enter image description here

Now I edit the local function code and publish it to azure before the log print to 79. During the deployment, both of the two functions still print the logs normally, until the function app restart (please refer to the two screenshots below). enter image description here enter image description here

According to the test, we can know the function can run normally when the code update during deployment until the function app restart. And the answer for your question is the deployment will update all of the function code and just restart the function app at last(only restart once).

=================================Update===============================

For your question of If the scale controller scales to multiple active instances in the same app, how are updates rolled out to each instance?. I think it will allow the instances running when update the code, but when complete update code the function app will restart, all of the running instances will be interrupted when restart function app.

And for your question of When the function app restarts, does it create only one instance or as many as the instance count before the restart?. I don't think the function app will create as many as the instance count before the restart. As you mentioned the function is host on a premium plan. So after function app restart, it will just provide the count of instances which you set for "Always Ready Instances" in "Scale out" tab. enter image description here For more information about "Always ready instances pre-warmed instances", you can refer to this document.

Hury Shen
  • 14,948
  • 1
  • 9
  • 18
  • Hi. My question was more about what happens to multiple instances? In your case, you have two functions and I believe they each get processed in the same instance. If the scale controller scales to multiple active instances in the same app, how are updates rolled out to each instance? When the function app restarts, does it create only one instance or as many as the instance count before the restart? – user246392 Jan 16 '21 at 14:00
  • @user246392 Sorry, I assumed you want to know the logic of functions in function app but not instances because you mentioned `does the runtime stop all active instances in a Function app` but not `does the runtime stop all active instances of a function`. For the questions you mentioned above, I have update my answer, please check the "Update" in my answer. – Hury Shen Jan 18 '21 at 02:49