Omar Himada
Omar Himada

Reputation: 2588

Saving on Azure billing cost with App Services?

I have a .NET Core application currently running as an Azure App Service, and I need it to do a lot of 'work' only about a few times a day. In order to save on the hourly billing, this is the solution I developed:

  1. Using a runbook (Azure Automation): scale the App Service Plan to the 'Free' tier at 7:00 PM
  2. Using a runbook (Azure Automation): scale the App Service Plan back up to the premium tier at 8:00 AM
  3. Hard-code my .NET Core application to ensure it only does the heavy 'work' between 8:00 AM and 7:00 PM

This is fine as it saves me a significant portion of cost, as I'm only paying for the hours in which the App Service Plan is scaled up to the premium tier. However it is definitely not ideal.

My question is - what design pattern should I implement in order to accomplish what I'm trying to do? I need a lot of compute resources but only for a few hours out of the day. I know AWS has 'spot' instances that you can configure - is there a similar mechanism in Azure?

Ideally I could implement a solution that involves me only paying for those heavy compute resources when I actually need it (e.g.: a few times a day, while the sun is up)

Thank you for any insight and help!


EDIT in regards to the type of computation, my summary is essentially a few ML.NET trainers running in parallel with some moderate Elasticsearch document writing

Upvotes: 1

Views: 854

Answers (2)

Alex
Alex

Reputation: 18526

It is pretty tough to answer this with the whole description of your workload being a "lot" of "heavy compute".

If you can put your "compute" into Azure Functions, going serverless with a consumption plan will probably be the nicest solution. However, individual function executions have a given timeout, so you need to see if your app fits the bill.

As an alternative, you can put your application into an Azure Container Instance, and spin that up on demand.

If you have REALLY high workload, you can use Azure Batch. If your current workload can be done on an AppService plan, this may be "overkill".

The equivalent to AWS spot instances is called Azure Spot Virtual Machines. You can also use them with Azure Batch.

Upvotes: 2

Thiago Custodio
Thiago Custodio

Reputation: 18387

Yes, you can switch to Serverless. Host front end on Storage Accounts and back end move to Azure Functions (Consumption Plan).

PS: If it's a long running processing, it may not be the best solution unless you use Durable Functions.

Upvotes: 1

Related Questions