Function pricing (consumption vs premium) in Azure - Performance Comparison
When using Azure Functions, it's important to understand how the cost and performance grow as your app handles more requests.
We want to see how the number of function executions affects the overall work done and cost in consumption and premium plans.
Analyze the time complexity of processing multiple function requests under different pricing plans.
// Consumption plan: Functions run on demand, billed per execution
// Premium plan: Functions run on pre-warmed instances, billed per instance and execution
for (int i = 0; i < n; i++) {
await Function.ExecuteAsync(requests[i]);
}
This loop simulates processing n function requests one after another.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: Executing a function instance for each request.
- How many times: Exactly n times, once per request.
- Additional operations: In consumption plan, each execution may trigger cold start delays; in premium plan, instances are pre-warmed reducing start time.
As the number of requests n increases, the total executions increase linearly.
| Input Size (n) | Approx. Function Executions |
|---|---|
| 10 | 10 executions |
| 100 | 100 executions |
| 1000 | 1000 executions |
Each new request adds one more function execution, so the work grows steadily with the number of requests.
Time Complexity: O(n)
This means the total work and cost grow directly in proportion to the number of requests processed.
[X] Wrong: "Premium plan always means faster processing regardless of request count."
[OK] Correct: Premium plan reduces cold starts but still processes each request individually, so total work grows with requests just like consumption plan.
Understanding how function executions scale helps you design cloud apps that balance cost and performance as demand grows.
"What if we batch multiple requests into a single function execution? How would the time complexity change?"