Scaling in AKS #2295
-
I am looking for guidance on how scaling works when durable functions are running as a container in AKS. In our scenario we'd like to use a TimerTrigger to start an orchestration batch function that will fan out to multiple activity functions and await all the tasks to do some aggregation. When built as a container and deployed to AKS it seems to always be limited to the single container instance. In AKS, is this supposed to scale up given enough tasks in the queue or only when running in a function app service plan? I have a simple POC based on the DurableFunction template using the storage account backend that calls the SayHello activity 100 times. Each activity sleeps for 30 seconds and maxConcurrentActivityFunctions is the default 20, however this never triggers any scaling. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
There is no automatic scaling for Azure Functions when running in AKS. If you use Durable Functions on AKS and your app is allocated only to a single replica, then all activities, etc. will only run on that one replica. This is because the Functions runtime doesn't have any understanding of the compute platform it's running on, and therefore cann't directly control the scaling. However, if you manually scale your pod to multiple replicas, Durable Functions will automatically distributed activity function executions across all available replicas. In other words, it can discover the new replicas on its own, but can't create new replicas on its own. Something external needs to allocate the new replicas. For AKS and Kubernetes in general, we advise two things to get up and running with an auto-scaled Durable Functions solution:
You can find some basic instructions for setting this up here: https://microsoft.github.io/durabletask-mssql/#/kubernetes The reason we advise the MSSQL storage provider is because that's the only one that supports scaling via KEDA (we don't have a KEDA scaler for the default Azure Storage backend). You can still use the Azure Storage backend with Durable Functions on AKS, but you'll have to implement your own auto-scaling. |
Beta Was this translation helpful? Give feedback.
There is no automatic scaling for Azure Functions when running in AKS. If you use Durable Functions on AKS and your app is allocated only to a single replica, then all activities, etc. will only run on that one replica. This is because the Functions runtime doesn't have any understanding of the compute platform it's running on, and therefore cann't directly control the scaling.
However, if you manually scale your pod to multiple replicas, Durable Functions will automatically distributed activity function executions across all available replicas. In other words, it can discover the new replicas on its own, but can't create new replicas on its own. Something external needs to allocate the n…