Urgent : Help with edge function scaling

Jean-Philippe Nitkowski 20 Reputation points
2025-03-25T14:08:32.77+00:00

Hi, 

We are facing issues with edge Function app azure that became critical in our service proposal. This is quite an emergency because this is our last open topic for the release of our b2b product planned for this week. The current architecture leads to instability.  We recently deployed an Azure Function App whose main purpose is to run a function that processes documents. This function takes quite a while to execute and is triggered by an Azure queue. It also consumes a significant amount of memory (4 GB).

From the documentation, we couldn’t clearly determine which configuration variable allows us to adjust the amount of resources available to each function during execution. Based on our understanding, there are two potential variables we can modify:

  1. App scale out > Maximum instance count in the Azure portal. This setting is global to the Function App and concerns scaling the entire application, so it does not affect the amount of resources available to each individual function execution.
  2. batchSize in the host.json file under extensions => queues => batchSize. We’ve understood that if this variable is set to 1, then each function execution would have the full 4 GB of RAM configured at the application level. Did we understand this part correctly? Some of our tests have made us uncertain.

Next, how can we observe the application’s scaling when multiple executions are triggered at the same time? For example, in Container Apps, we can see active replicas. Is there an equivalent view for Function Apps?

Finally, in the host.json we also have to configure extensions => queues => newBatchThreshold. According to the documentation, it needs to be less than batchSize. Would setting it to 0 potentially cause any issues?

Thank you in advance for your support

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,711 questions
{count} votes

Accepted answer
  1. Khadeer Ali 4,880 Reputation points Microsoft External Staff
    2025-03-25T15:14:34.77+00:00

    @Jean-Philippe Nitkowski ,

    Thank you for reaching out. We understand the urgency of resolving the instability in your Azure Function App, given the critical role it plays in your B2B product release. Below are our insights and recommendations regarding your concerns:

    1. Understanding Resource Allocation You are correct that the Maximum instance count setting in the Azure portal controls the overall scaling of the Function App but does not directly affect the resources available to each function execution. Regarding the batchSize setting in host.json (under extensions => queues): Setting batchSize to 1 ensures that each function execution processes a single message at a time. In this case, the function execution will have access to the full memory allocated to the Function App (4 GB in your scenario). However, memory allocation still depends on the selected hosting plan. If you are using the Consumption Plan, function executions may share compute resources within the same instance. For dedicated memory allocation, the Premium Plan (e.g., EP2 or higher) is recommended.
    2. Azure Functions do not provide a direct equivalent to active replicas (as seen in Container Apps), but you can monitor scaling behavior through: 🔹 Azure Monitor & Application Insights
      • Navigate to Azure Portal > Function App > Metrics and add:
      • "Function Execution Count" – to monitor concurrent executions.
      • "App Service Plan Instance Count" – to track instance scaling.
      🔹 Kudu Process Explorer 🔹 Azure CLI / PowerShell
    3. Configuring newBatchThreshold The newBatchThreshold setting should always be less than batchSize to avoid processing inefficiencies.

    Setting newBatchThreshold = 0 could lead to issues, as it may prevent the function from processing new batches unless a certain threshold is met.

    It is recommended to set this value to a small number (e.g., 1 or 2) to allow for efficient batch processing while ensuring timely execution.

    Recommendations for Stability

    • Upgrade to the Premium Plan (EP2 or higher) for dedicated memory per function execution.
    • Set batchSize = 1 to maximize available memory per execution.
    • Monitor scaling with Azure Metrics, Kudu, and Azure CLI.
    • Ensure functionTimeout is configured appropriately in host.json to support long-running executions.
    • Consider using Azure Durable Functions if processing time is extensive.
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.