Anodyne
Anodyne

Reputation: 1852

CPU, RAM and I/O intensive code runs slowly on Azure Functions

We have some code that is fairly CPU, RAM and I/O intensive (it creates lots of temporary files, decompresses, resizes and compresses images). We're trying to integrate this into a "serverless" web application, and seeing as our code only runs on Windows at the moment we're testing it on Azure Functions.

We've observed that our code runs considerably slower on Azure Functions than it does on my local workstation (Core i7-4790, 16GB RAM, SSD). For example, one typical workload gives us these timings:

Dev workstation:                                2.47 sec
Azure Functions, "App Service" plan (S3 size): 10.59 sec
Azure Functions, "Consumption" plan:           15.96 sec

We've also found that on the "Consumption" plan, timings vary quite widely - one particular job gave us times varying between 112 and 153 seconds. The same job on the S3 "App Service" plan took between 117 and 119 seconds, and around 31 seconds on my workstation.

Timings on P3 were similar to S3, which is about what I expected as the CPU and RAM specs are the same.

So I have a few questions really:

  1. Is there anything we can do to profile our application running on Azure, to identify where the bottlenecks might be?
  2. Are we crazy to be trying to run such a heavy workload on Azure Functions?
  3. Does anyone have any suggestions as to how we could get our code running on more powerful hardware without swallowing all the complexity of managing a farm of virtual machines?

Upvotes: 9

Views: 1705

Answers (1)

Mikhail Shilkov
Mikhail Shilkov

Reputation: 35124

  1. You can profile App Service app (including Function App) remotely, see this link. I used Kudu and it worked good.

  2. Really depends on your targets. The timings that your quoted can be perfectly fine for some applications.

  3. This seems to be too broad a question for SO.

A more FunctionApp-ish approach would be to try to break down your long-running function into smaller short-running functions, and thus break down and potentially parallelize the processing.

Upvotes: 1

Related Questions