Azure functions are slow
Asked Answered
R

1

13

I’m testing the CPU performance of functions, so I made a function that finds the prime numbers in a number. It is triggered by Azure Service Bus. On my local machine it runs in 350ms.

The function, when running in a consumption plan, takes around 1000ms. When I batch send 100 messages to the function, it does scale up to around 16 instances, but the performance of each function decreases considerably to between 3000-7000ms.

When trying a standard service plan with 4 cores, the performance is better, but not that much. It is still considerably slower than my laptop. This guy here has a similar issue.

Is this the performance/scaling to be expected from functions? E.q. not a great fit for batch processing of CPU intensive methods?

Would Azure batch be a better fit?

Regressive answered 15/8, 2017 at 7:49 Comment(0)
L
4

I don't know the exact specification of the hardware that Functions are running on, but you can assume that each instance of Consumption plan is a low-profile single-core VM. If you need to run CPU-intensive latency-critical workload, that's probably not a good match.

Your local machine is probably faster that those instances, so that's where 350ms vs. 1000ms difference comes from.

The decrease to 3000-7000ms is related to the fact that multiple executions of functions are running at the same time on the same instance. They are competing for CPU, slowing each other down. For pure CPU-bound workloads, you might be better off setting "maxConcurrentCalls": 1 in host.json.

Lylalyle answered 15/8, 2017 at 8:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.