1
votes

I'm hosting some of my Azure Functions on an App Service plan, in order for the function to be able to communicate with a virtual network (through point-to-site). Most of these functions are timer based, meaning that they will trigger at a certain time every month, date, hour, etc.

I've noticed when looking through the metrics, that the function apps run on all instances in my app service plan. I can see why this is a good choice for something like queue triggered or HTTP triggered functions.

What about my timer triggered functions? I just want to make sure that each function run on the configured schedule. Having 10 instances of the function host running (in the case where I have 10 instances in my app service plan) seems to be a vaste of memory, since every function host uses at least 30 mb of memory (300 mb in total for the 10 instances).

Anyone got some recommendations? I know that it would be more efficient to move these to consumption based functions, but then I don't have the possibility of connecting to a virtual network.

Update: There's a config option named WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT but this only work on the consumption plan.

2
FYI you can now use consumption plan for vNet joined functions using the premium plan which is in preview. It is more expensive so may not do what you want, but worth a look.Sam Cogan
Thanks. I did see that one. It's still in preview why I don't want to use it yet. An alternative would be to create a new app service plan with a single instance and move my timer functions to that plan. Would sort of be the same as premium function plan.ThomasArdal

2 Answers

1
votes

App service plan will dedicate you a virtual machine to run your functions. If you have long-running, continuous, CPU and memory consumable algorithms, this is the option you want to choose to have the most cost-effective hosting plan for the function operation.

The memory use of a Function within an App Service Plan is limited to the configuration of the VM. In Consumption plan, memory usage is limited to 1.5 GB. In App service plan, your Functions can consume more than 1.5 GB of memory.

Here is an article you could refer to.

0
votes

Currently, an Azure Function app on an App Service plan will run on all instances the plan is scaled to. If your functions are all timer-triggered, moving them to a single-instance app service plan will reduce your memory usage. However, it sounds like you have some other trigger types as well that would benefit from scaling by staying on your 10-instance plan, in which case it makes less sense to split your functions up.