azureazure-functionsazure-eventhubazure-function-appevent-processor-host

If an Azure Function App scales down to 0 in a Consumption Plan, how can it listen to incoming events from Event Hub?


Suppose I have an Azure Function App in a Consumption Plan listening on an Azure Event Hub. According to this documentation, the number of function app instances can scale down to 0 if there are no incoming events. In my understanding, every function app instance also instantiates an Event Processor Host which is listening on partitions of the event hub. But if the number of instances is 0, who is then listening on the event hub to determine if messages must be processed? Does an Event Processor Host exist when the number of instances of a function is 0? Here is the (incomplete) picture I have so far about Azure Functions + Azure Event Hubs which I'd like to complete: enter image description here

In said documentation I also read about the scale controller which apparently adds new function host instances when needed. Does this mean, the scale controller must also listen on the event hub? Where is the scale controller located, is it part of the function app resource I can create in Azure or is the scale controller hosted in an isolated part of Azure independent of the existence of my function app?

Edit: Adopted image based on answers.


Solution

  • This is what the managed Function runtime on Azure is doing for you. It listens to the Event Hub (or Service Bus, or other supported trigger sources) for you - and you do not have to pay for that compute. Once it detects new messages, it will spin up one or more instances of your Function - at which point only the billing starts.

    enter image description here

    Source

    If you are running Functions somewhere else, e.g. in a k8s cluster, you have to host the scale controller yourself and keep it running all the time.