← Azure Functions memory calculator
How the Azure Functions calculator works
This page walks through how the Azure Functions calculator turns your usage data into an instance size. It starts from the peak side of the shared sizing model; this page covers what happens after that. Statements backed by Microsoft's documentation end with an Azure docs link to it. Choices the documentation doesn't make for us are explained and marked Assumption, which links to its row in the table of all of them.
01 Fixed instance sizes
Azure Functions doesn't take a free-form memory value. Flex Consumption, the recommended serverless plan, offers three instance sizes: Azure docs
| Instance memory | CPU cores | Default HTTP concurrency |
|---|---|---|
| 512 MB | 0.25 | 4 |
| 2,048 MB | 1 | 16 |
| 4,096 MB | 2 | 32 |
Python apps default to an HTTP concurrency of 1 at every size. Azure docs Each instance also gets 272 MB the platform keeps for system and host processes, which isn't billed. Your function code and the Functions host share the instance's resources. Azure docs
02 From peak usage to an instance size
memory = peak × (1 + limit margin)
size = the smallest Flex Consumption size ≥ max(memory, 2,048 MB), else the smallest Elastic Premium SKU ≥ memory
Running out of memory recycles the instance, so, as with Lambda and Cloud Run, only the peak sets the size. The limit margin comes from the sensitivity, workload type and environment you choose; the sizing model explains it.
Microsoft writes the sizes in MB but measures memory in MB and MiB interchangeably, so the calculator compares MiB with those MB as equal; the sizes being powers of two point the same way. Assumption
Worked example
Peak 630 MiB, generic workload, medium sensitivity, production:
| memory | 630 MiB × 1.30 | 819 MiB |
|---|---|---|
| instance size | 512 is too small; 2,048 fits | 2048 MB |
| CPU | for that size | 1 core |
A small function peaking at 50 MiB would fit 512 MB, but gets Microsoft's 2,048 MB default:
| instance size | 50 MiB × 1.20 = 60 MiB; at least 2,048 MB | 2048 MB |
|---|---|---|
| CPU | for that size | 1 core |
Lambda and Cloud Run also size from the peak alone: see the Lambda guide and the Cloud Run guide.
03 Microsoft's guidance: 2,048 MB and concurrency
Microsoft suggests 2,048 MB as the default for most apps, and 512 MB or 4,096 MB when concurrency or processing power call for it. Larger instances handle more concurrent executions, and CPU and network bandwidth grow with the size. Azure docs
So the calculator never goes below 2,048 MB: it picks the smallest size the measured peak fits in, from 2,048 MB up. 512 MB stays a choice you make by hand for a small, low-concurrency app, which then gets 0.25 cores and a default HTTP concurrency of 4; the note under the result says so. Assumption
Executions on an instance share its memory, so the measured peak includes the concurrency the app ran at. Raising concurrency, or moving to a size with a higher default, can need more memory per instance. Azure docs Assumption
05 What the calculator writes
az functionapp scale config set --resource-group <resource-group> --name <app> --instance-memory 2048
functionAppConfig: {
scaleAndConcurrency: {
instanceMemoryMB: 2048
}
}
-
az functionapp scale config set --instance-memorychanges a Flex Consumption app's size at any time. Azure docs -
In Bicep or ARM,
functionAppConfig.scaleAndConcurrency.instanceMemoryMBsets the memory of each instance. Azure docs -
For Premium,
az functionapp plan update --sku EP2changes the plan's SKU. Azure docs
06 Every warning, and why
| Message about | Shown when | Basis |
|---|---|---|
| Too big for Flex Consumption warning | The memory is above 4,096 MB | Flex Consumption's largest size. Azure docs |
| Above every Premium SKU warning | The memory is above EP3's 14 GB | Premium's largest SKU. Azure docs |
| Peak below average error | The peak you entered is lower than the average | Impossible with real samples; it usually means two different series. See the sizing model. |
07 Where the numbers come from
Azure Monitor's Memory working set (MemoryWorkingSet) is the memory the app uses now, and
Average memory working set its average; both can be split by instance. They aren't available for Linux
apps on the legacy Consumption plan.
Azure docs
Take the highest per-instance working set over a representative period as the peak.
08 All assumptions in one place
Besides the margins of the shared sizing model:
Our default: a value we chose. Our reading: how we read documentation that isn't explicit. About your setup: something we take for granted about your data or cluster.
| Assumption | Kind | Why | If it doesn't hold |
|---|---|---|---|
| Azure's MB are MiB ↩ | Our reading | The docs use MB and MiB for the same metrics; the sizes are powers of two | If they were decimal, a peak just under a size would be about 5% too big for it. |
| Never below Microsoft's 2,048 MB default ↩ | Our default | Microsoft suggests it for most apps; 512 MB brings less CPU and concurrency | A small, low-concurrency app could run on 512 MB for less; set it by hand. |
| Concurrency stays as when the samples were taken ↩ | About your setup | Executions on an instance share its memory | More concurrent executions per instance need more memory; size again after changing it. |
| The app is alone on its Premium plan ↩ | About your setup | Apps in a Premium plan share its instances | Add up the peaks of every app in the plan before choosing a SKU. |
Values you can change
The calculator’s Advanced: margins and defaults section, closed by default, lets you replace these values when your setup differs. Each field’s “?” says how it moves the result; a value outside the range is used at its nearest end, and “Reset to defaults” puts them all back.
| Value | Default | Range | Where the default comes from |
|---|---|---|---|
| Limit margin | from the profile | 0–200% | MemoryLimit’s default, from sensitivity, workload type and environment (sizing model); sizes the memory the instance size must fit |
| Minimum instance size | 2,048 MB | 512, 2,048 or 4,096 MB | Microsoft’s suggestion for most apps, assumption 2; 512 MB suits a small, low-concurrency app |
09 References
- Flex Consumption plan — instance sizes, cores, the 272 MB buffer and Microsoft's default.
- Concurrency in Azure Functions — default HTTP concurrency per size.
- Premium plan — EP1–EP3 and billing.
- Scale and hosting — memory limits per plan, Consumption's 1.5 GB.
- Manage Flex Consumption apps —
az functionapp scale config set --instance-memory. - Microsoft.Web/sites template reference —
instanceMemoryMB. az functionapp plan—update --sku.- Monitoring data reference —
MemoryWorkingSetandAverageMemoryWorkingSet.