About Azure Functions
Last modified on Mon 07 Nov 2022

Azure Functions is a Function-as-a-Service ("FaaS"), i.e. a platform for running configurable blocks of code that run in response to some event. Functions support several different programming languages such as C# and JavaScript, F#, Java, Python, and PowerShell.

The main benefits of using Azure Functions and serverless solutions are:


There are three basic hosting plans available for Azure Functions:

Note: If there is already an existing App service hosting some API that needs some background job to be executed, it might be a good candidate for Azure Web job. To learn more, see here.

A single-function app in the Consumption plan scales out to a maximum of 200 instances, while a single instance can process more than one message/request at a time.

Timer trigger functions are singleton (trigger only one instance of function).

In real-world scenarios, we need to control the scaling of instances. Sometimes Azure functions deal with databases or other services which may have scaling limits, so over-scaling Azure functions could put other resources under pressure. Scaling rules can be configured for a function depending on the trigger type.

Example: If for some reason, we needed queue messages to be processed by a function one at a time then we need to configure the function app to scale out to a single instance. Then the function concurrent processing should be limited too, and that is done by setting batchSize to 1 in the host.json. Learn more here and here.

Function Properties


Note: Some of the triggers come with default retry logic. Queue-triggered functions retry 5 times before sending message to poison queue, while the timer trigger function doesn't retry at all. When a time trigger function fails, it isn't called again until the next time on the schedule.