Pankaj Rawat
Pankaj Rawat

Reputation: 4573

Scale Azure function independently (single Function)

I've created Azure function using Visual Studio as library project, have single project with 12 functions e.g.

enter image description here

As of now my function hosted in Dedicated AppService Plan and one of function (EventHub listener) processes millions of message per-day, hence it utilizes 90%+ CPU all the time.

So we are planning to scale or Separate App Service plan for that single function. I see following possible solutions

  1. Change dedicated app service plant to consumption. (not sure about pricing impact or SLA).

  2. Create a new project, move single function in that project and deploy that function in a separate app service plan. (required code and CI/CD pipeline changes.)

  3. Deploy same function dlls in 2 AppService Plan and remove functions according to scale. (not sure this is possible with Azure DevOps or not).

would like to know the better approach, if customer does not agree on consumption plan.

Upvotes: 2

Views: 1068

Answers (2)

MarkXA
MarkXA

Reputation: 4384

The advantage of a dedicated plan over a consumption plan is predictability. Running a workload on a consumption plan will usually work out faster and cheaper than running the same workload on a dedicated plan, but using a dedicated plan does prevent unexpected spikes in usage from leading to unexpected spikes in cost and also prevents cold start issues.

If you switch to the consumption model (option 1), you're paying for individual function execution so whether you run one or two function apps makes no difference from that point of view. You should decide how to split your functions based on how independent they are. If you'll only be deploying them as a single unit then stick to one function app, but if you may want to update the listener separately, put it in a separate project.

If you split into two apps running on separate dedicated service plans, creating a new project (option 2) is certainly the cleanest way to go about it. However, deploying the same project to both apps (option 3) is technically possible - you just need to disable the functions that shouldn't run on each app using app settings. Create settings named AzureWebJobs.MyFunction.Disabled with value true (see https://learn.microsoft.com/en-gb/azure/azure-functions/disable-function#functions-2x---all-languages).

Upvotes: 2

4c74356b41
4c74356b41

Reputation: 72151

  1. wont help you, it scales all the functions in the function app
  2. that will work
  3. its the same as version, just with 2 app service plans, not one.

Better approach is - isolate this function into a single Azure Function App and then you can scale it independently.

Upvotes: 2

Related Questions