Functions with Timed trigger and App Service plan multiple instances

Dan Parker 101 Reputation points
2020-06-06T16:28:26.413+00:00

Just to make sure, when I autoscale or have multiple instances of my app service plan on a scale up, my functions won't run multiple times right? If it's timer triggered it only does it once.

Anything to worry about in other trigger types? say the Singleton attribute would only be per instance right, and if triggered by a queue, only the 1st instance to get that queue trigger would take it I would assume.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,333 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,963 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Mark Allan 421 Reputation points MVP
    2020-06-06T17:23:04.42+00:00

    Yes, a timer trigger will only run once regardless of the number of instances in your plan, though if it's a short interval then it's possible that one invocation may not have finished before the next one starts. For other trigger types each message will be processed only once (assuming processing is successful) but messages may be processed concurrently, in batches for some trigger types, and by multiple instances. The [Singleton] attribute will restrict a function to only run one at a time across all instances, but do be aware that if you're on a Consumption Plan then you'll be charged for the runtime of any instance waiting for another instance to complete, which could significantly increase your costs, so it's not recommended.

    2 people found this answer helpful.
    0 comments No comments