Azure Flex Consumption function cost can exceed "24/7 usage"

Matias Kiviniemi 80 Reputation points
2026-11-19T15:16:08.69+00:00

What Azure Flex function pricing tells you is that you are priced the Gb-s for the time you are executing requests. Implication is that a 2Gb function should have a hourly maximum cost of 26060*$0.000026 ~$0,19 per instance. However putting a function to full load can cost you $20+ per hour even if you have max instance 1 and concurrency 1.

I think what happens is that when the server is idle (your function is the only one with traffic) it's allowing all the "VM's/Node processes/what ever the customer separation with functions is" execute your function. I.e. if it would be 16 core 32GB processor you'd get 16x of your function running. When we sampled what process id serves your request we got about 40 distinct processes on a single function.

Another way you can see that you can get a ton of compute out of single function (sometimes). We used 20000 rounds of SHA256 as a reference which timed to about 20ms in my local i13900. A 2GB function did 370req/s i.e. about 7x my local machine. This stays the same regardless if you use max concurrency of 1 or 16. When we switched to EP1 premium plan with fixed cores that dropped to ~60req/s which is more like a single core output.

Not sure if this a bug or just me misunderstanding what is offered but predicting cost this way is pretty hard.. Below a Claude summary of the tests.

**Subject:** Flex Consumption "On Demand Execution Time" billed 13–20× the instance time possible with maximumInstanceCount = 1

**Resource**
- Node.js 22, a single anonymous HTTP trigger, on-demand only (no always-ready instances)
- `maximumInstanceCount = 1` throughout. The "Instance count" metric stayed at 1, with brief 1.1–1.3 readings.

**Test**
- A CPU-bound HTTP handler (about 20,000 SHA-256 rounds per request).
- Load from one client: `autocannon -c 50` (50 parallel connections) for 1 hour.
- One test per UTC day, with no other traffic to the app. Between test days I changed only instance memory and per-instance HTTP concurrency.

**Results** (billed quantities from Cost Management, meter "On Demand Execution Time"; billed executions match the requests the client sent)

| UTC day | Memory | Per-instance concurrency | Duration | Requests (client) | Executions billed | Throughput | Billed GB-s | Max GB-s possible (memory × duration × 1 instance) | Ratio |
|---|---|---|---|---|---|---|---|---|---|
| 2026-11-09 | 4096 MB | 16 | 1 h | ~1.9 M | 1,904,100 | ~470/s | 269,536 | 14,400 | 18.7× |
| 2026-11-11 | 2048 MB | 16 | 1 h | 1,352,000 | 1,352,140 | 376/s | 93,235 | 7,200 | 12.9× |
| 2026-11-13 | 512 MB | 16 | 1 h | 557,000 | 556,670 | 155/s | 35,768 | 1,800 | 19.9× |
| 2026-11-14 | 2048 MB | 1 | 1 h | 1,517,000 | 1,517,050 | 422/s | 93,496 | 7,200 | 13.0× |

The app's Azure Monitor metric "On Demand Function Execution Units" (MB-ms) matches these billed quantities.

**Why this looks wrong**
1. The Flex Consumption documentation says on-demand execution time is "the total amount of memory provisioned while each on demand instance is actively executing functions". The cost examples bill concurrent executions on one instance once (2 GB × 3600 s = 7,200 GB-s). With one instance, a 2 GB app can't exceed 7,200 GB-s in an hour, yet 93,000+ GB-s was billed.
2. On 2026-11-14 per-instance concurrency was 1. Only one execution could run at a time on the single instance, so execution time can't add up to more than the wall-clock hour. Throughput was 422 requests/s, i.e. ~2.4 ms of instance time per request. Billing still came to ~30.8 ms × 2 GB per execution, the same total as at concurrency 16 (93,235 vs 93,496 GB-s).
3. The ratio doesn't follow concurrency or memory in any documented way.

Azure Functions
Azure Functions

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

0 comments No comments

1 answer

Sort by: Most helpful
  1. AI answer

    2026-11-19T15:17:34.93+00:00

    Your results are inconsistent with the documented Flex Consumption billing model for one HTTP function, one on-demand instance, and no always-ready instances, so open an Azure billing support request with the metric exports and request-level telemetry rather than treating this as expected concurrency behavior.

    For a continuously active 2,048-MB instance, the documented calculation is:

    2 GB × 3,600 seconds = 7,200 GB-s per hour
    

    Microsoft uses that exact one-instance calculation in its Flex Consumption pricing example. Concurrent requests on the same active instance do not multiply the instance-memory charge. The 1,000-ms minimum applies to an active execution period, including concurrent executions, rather than separately multiplying every overlapping request by one second.^1^^2^

    Your approximately 93,500 GB-s result therefore represents about 13 continuously active 2-GB instance-hours:

    93,500 ÷ 7,200 ≈ 13.0
    

    That cannot be reconciled with the documented one-instance model merely by setting HTTP concurrency to either 1 or 16.

    Capture the billing discrepancy

    1. In the Azure portal, open Function App → Monitoring → Metrics.
    2. Select the exact UTC test interval.
    3. Add these metrics using Sum:
      • On Demand Function Execution Units
      • On Demand Function Execution Count
      • Always Ready Function Execution Units
      • Always Ready Units
    4. Export the chart data to CSV.
    5. Convert execution units to billed GB-seconds:
    On Demand Function Execution Units ÷ 1,024,000
    

    On Demand Function Execution Units is defined as fixed instance memory multiplied by total active execution time in MB-ms; dividing by 1,024,000 produces the On Demand Execution Time meter in GB-s.^3^

    1. Add Automatic Scaling Instance Count separately. This metric is emitted every 30 seconds and can aggregate all instances used during that interval, so an average such as 1.1–1.3 is not a reliable proof of simultaneous instance count. Use the smallest available time grain and the documented aggregation guidance.^3^
    2. Export Application Insights request data for the same UTC interval, including:
      • timestamp
      • duration
      • operation/request ID
      • cloud role instance
      • success and result code

    Process IDs alone do not establish how many billable Functions instances existed; include them as supplementary evidence, not as the primary instance identifier.

    Verify the scope of the configured limit

    The Flex maximum is applied to on-demand instances per function scale group, not to the combined app total. All HTTP triggers belong to the same HTTP scale group, while always-ready instances are outside this maximum.^4^

    For your stated single HTTP function and zero always-ready instances, that distinction should not account for a 13× result. Nevertheless, attach evidence of the effective live configuration:

    az functionapp scale config show \
      --resource-group <RESOURCE_GROUP> \
      --name <APP_NAME>
    

    The case should show that the test interval had:

    • maximumInstanceCount = 1
    • HTTP perInstanceConcurrency = 1 for the final test
    • no always-ready HTTP instances
    • only the tested HTTP function receiving traffic

    Open the support request

    Create an Azure billing support request and include:

    • subscription and function-app resource identifiers
    • exact UTC start and end times for each run
    • region, runtime, memory size, and deployment/version identifier
    • effective scale and concurrency configuration
    • exported metric CSV files
    • Cost Management export showing the meter and quantity
    • request telemetry and load-generator totals
    • the expected-versus-observed table
    • this concise discrepancy:

    With one HTTP scale group, maximumInstanceCount=1, no always-ready instances, and 2,048 MB configured memory, the documented continuous one-hour maximum is 7,200 GB-s. Azure Monitor and Cost Management both report approximately 93,500 GB-s for the same interval. Please reconcile the per-instance execution-unit records with the scale records and investigate the On Demand Execution Time meter.

    There is a similar public report involving Flex Consumption exceeding a configured instance limit, but it has no accepted resolution and does not establish this as a publicly acknowledged platform defect.^5^

    Until Microsoft reconciles the meter, the observed $20+/hour should not be considered documented or predictable behavior. Moving this CPU-bound workload to Premium may provide more predictable fixed capacity, as your test indicates, but it does not explain or validate the Flex charge.


    References

    1. Estimating consumption-based costs in Azure Functions | Microsoft Learn
    2. Clarification on Flex Consumption Billing: Minimum 1000ms rule for Sequential vs. Concurrent requests - Microsoft Q&A
    3. Monitoring data reference for Azure Functions | Microsoft Learn
    4. Event-driven scaling in Azure Functions (flex-consumption-plan)
    5. Flex Consumption scales beyond maximumInstanceCount (31 instances with a limit of 20) - Microsoft Q&A
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

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.