How do I configure auto-scaling AND troubleshoot cold starts on Azure Functions?

Gini Hu 40 Reputation points
2026-11-23T05:35:48.2366667+00:00

I run a .NET 8 isolated Azure Function on the Consumption plan. I need to (1) understand how to set up auto-scale behavior and (2) reduce noticeable cold-start latency for HTTP-triggered functions. Please cover both topics in one answer.

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.

0 comments No comments

Answer accepted by question author

AI answer

2026-11-23T05:36:40.6533333+00:00

On the legacy Consumption plan, Azure Functions controls event-driven scale-out automatically, so configure only an optional instance cap; for .NET 8 isolated cold starts, enable isolated-worker placeholders and ReadyToRun, then move to Flex Consumption or Premium if consistently warm HTTP capacity is required.

Configure Consumption-plan scaling

The scale controller monitors incoming events and adds or removes host instances. On Consumption, the entire function app is the scaling unit: all functions in the app share resources and scale together. For HTTP triggers, new instances are allocated at most once per second.^1^

There is no CPU- or schedule-based autoscale rule to create for this plan. Concentrate on these controls:

  1. Leave the scale limit unrestricted unless a downstream system needs protection.
    • functionAppScaleLimit set to 0 or null means unrestricted up to the plan maximum.
    • A value from 1 upward imposes a lower app-level maximum.
  2. To impose a limit, for example 20 instances:
az resource update \
  --resource-type Microsoft.Web/sites \
  --resource-group <RESOURCE_GROUP> \
  --name <FUNCTION_APP>/config/web \
  --set properties.functionAppScaleLimit=20

A low cap can increase HTTP latency or cause rejection under load, so load-test at expected peak traffic before reducing it.^1^

  1. Check for accidental scale restrictions.
    • Review functionAppScaleLimit.
    • Check whether a Daily Usage Quota established during development is still present.
    • Review trigger concurrency and singleton patterns, which can artificially restrict throughput.^2^

If HTTP and background functions have substantially different load profiles, separate function apps can provide independent scaling boundaries. Within one Consumption-plan app, all functions scale together.^2^

Reduce .NET 8 isolated cold-start time

Consumption apps can scale to zero after being idle. The next HTTP request must start an instance, host, worker process, and application; legacy Consumption has no always-ready setting, so cold starts remain expected.^1^

1. Enable .NET isolated placeholders

First ensure the project uses:

  • Microsoft.Azure.Functions.Worker 1.19.0 or later.
  • Azure.Functions.Sdk 1.0.0 or later.
  • A Microsoft.AspNetCore.App framework reference.

For example:

<ItemGroup>
  <FrameworkReference Include="Microsoft.AspNetCore.App" />
  <PackageReference Include="Microsoft.Azure.Functions.Worker"
                    Version="1.21.0" />
</ItemGroup>

Then configure the app:

az functionapp config appsettings set \
  --resource-group <RESOURCE_GROUP> \
  --name <FUNCTION_APP> \
  --settings WEBSITE_USE_PLACEHOLDER_DOTNETISOLATED=1

az functionapp config set \
  --resource-group <RESOURCE_GROUP> \
  --name <FUNCTION_APP> \
  --net-framework-version 8 \
  --use-32bit-worker-process false

The target-framework configuration must match the project, and placeholders require the remaining app configuration to be correct or the app might fail to start. The app-setting change restarts the function app.^3^^4^

2. Publish ReadyToRun binaries

ReadyToRun performs ahead-of-time compilation and can improve startup performance on Consumption. It is supported for .NET 8 isolated apps on Functions runtime 4.x.^3^

Add properties matching the Function App operating system and architecture:

<PropertyGroup>
  <TargetFramework>net8.0</TargetFramework>
  <PublishReadyToRun>true</PublishReadyToRun>
  <!-- Use win-x64 for 64-bit Windows or linux-x64 for Linux. -->
  <RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>

Publish for that runtime:

dotnet publish -c Release -r win-x64 -p:PublishReadyToRun=true

A runtime-identifier/hosting-architecture mismatch can cause startup failure.

3. Identify what portion is actually slow

Compare a request after several idle minutes with an immediate second request:

  • If only the first request is slow, investigate startup and cold start.
  • If both are slow, inspect application initialization and dependency calls.
  • Use Application Insights transaction diagnostics to correlate requests, exceptions, and outbound HTTP, database, file-system, or Azure SDK dependencies. Dependency telemetry records call duration and failure state.^5^

Keep startup work small: avoid eagerly initializing large dependency graphs or making network calls during process startup where those operations can be deferred safely.

When optimization is not enough

Legacy Consumption cannot maintain a warm minimum instance. For predictable low-latency HTTP responses, migrate to:

  • Flex Consumption, which has improved scale-from-zero behavior and supports configurable always-ready instances.
  • Premium, which supports prewarmed and always-ready instances, with at least one instance continuously available.^6^

This changes the solution from reducing cold-start duration to maintaining warm capacity, with the corresponding increase in baseline cost.


References

  1. Event-driven scaling in Azure Functions (consumption-plan)
  2. Best practices for reliable Azure Functions
  3. Guide for running C# Azure Functions in the isolated worker model
  4. App settings reference for Azure Functions
  5. Dependency tracking in Application Insights
  6. Azure Functions hosting options
AI-generated content may be incorrect. Read our transparency notes for more information.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Oldest

Your answer

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