Reputation: 608
I understand that timer triggered azure function doesn't scale, so I created multiple such functions, hopefully can solve the scale issue. but what I found out is that all those functions always run on the same instance, 2 others are idle all the time.
when I had only one timer triggered function, all instance run it in rotation.
btw, I am using azure function slot.
Thanks. Lidong
Upvotes: 2
Views: 1960
Reputation: 35134
Timer Triggers are not the best solution to do load balancing of your workload.
When your Function App starts, the first instance will acquire lock and will run all the timer jobs. When the second instance comes up, it won't add any immediate value, because the locks are already taken.
A quick workaround could be to use multiple Function Apps, but I won't recommend that.
If you have some heavy lifting to be done on timer, I would suggest you splitting your function into a quickly executable and resource non-demanding timer part, and send the rest to a queue. The queue trigger will be able to spread the load among instances as you need in order to complete resource-intensive workload.
Upvotes: 3