Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Azure charge for number of app services

Does Azure charge only for the utilization of App service plan resources or for the number of app services we create under that App service plan? Does the number of app services created under a app service plan effects cost?

I am developing a microservices project and I am unsure of whether to deploy each microservice in a dedicated app service or deploying all in one app service as virtual directories. Cost is a concern for our project.

Thanks.

like image 278
Isuru Avatar asked Aug 29 '19 05:08

Isuru


Video Answer


1 Answers

Does Azure charge only for the utilization of App service plan resources or for the number of app services we create under that App service plan?

Ignoring the Free and Shared tiers, you'll pay only for the App Service Plan (cost per selected machine size x number of instances). You'll pay the same whether you have 0 or 50 Apps on the Service plan (although any other I/O, Storage etc consumed by those Apps will be additional).

(Whereas the free tier allows a max of 10 Apps, and the Shared tier allows 100 Apps)

In theory you can then add as many App Services (apps, e.g. Web Apps, Services, Function Apps etc) as you like on each App Service Plan, however in practice you'll be limited by the overall resources of the VM size and plan you've selected (e.g. 10GB Disk space on Basic, and a B1 only has 1.75GB RAM).

From the Microsoft docs, the recommendation is:

Isolate your app into a new App Service plan when:

  • The app is resource-intensive.
  • You want to scale the app independently from the other apps in the existing plan.
  • The app needs resource in a different geographical region.

I would also add the opinion:

  • If applicable, keep your environments (Dev, UAT, Prod) isolated, either at App Service Plan level, or consider isolation at Resource Group or Subscription level.
  • Unless your apps are maxing out CPU usage, while installing as many apps per Service Plan as makes logical sense, but monitor performance and the resource usage on the VM instances as you go.
  • In my situation, I've typically found that RAM to be the bottleneck, so I would typically try to scale up to a VM size with more RAM to host more Apps before separating out the Apps and adding more Service Plans.
  • If you are on .Net Core or another stack which doesn't need Windows, I would recommend looking into the Linux Service Plans - they are considerably cheaper than Windows instances. One caveat - as at present, there's a weird limitation which doesn't allow mixing of Windows and Linux Service Plans in the same resource group.
  • Each App is logically fairly well isolated on the Service Plan instances, so you can add, delete, and deploy apps without interfering with the others.
  • Although Docker containers can be deployed as an App Service, you might find AKS a better fit.

And More Detail

The terminology around the Azure Managed App Service Plans is somewhat confusing, but to clarify:

  • An App Service Plan (Service Plan) can have 1 or more managed VM instances e.g. 1 Service Plan scaled to 3 Instances = 3 VMs to pay for.

  • Ignoring the Free / Shared tier (on the shared tier you pay for each App), and also ignoring the Isolated tier, you'll pay a fixed monthly cost for each Instance

  • You can add multiple Apps to each App Service Plan - e.g. Web Apps, Function Apps, Misc. Console Apps, and Docker images. These will be deployed to all instances in the plan.

  • On the Standard tier and above, you can also configure Deployment Slots on your Apps, which provides the ability to smoke-test and provide continued uptime during deployments, especially in your production environment.

App Service Plans (microsoft.web/serverfarms) account for approximately 40% of our overall Monthly Azure costs

This cost can quickly multiply, especially if you are running multiple isolated environments (Dev, UAT, Prod etc) and if you need to scale out to more than one instance per environment for redundancy or scale reasons.

As at time of writing, indicative VM instance costs on US East are approximately

  • Dev B1 1.75GB RAM are ~$15pm Linux / ~$50pm Windows
  • Prod P1V2 3.5GB RAM are ~$80 Linux / ~$150pm Windows

So it's only natural to try and minimize costs by deploying multiple apps to a single VM, especially in a fine-grained Microservice enterprise or system.

like image 166
StuartLC Avatar answered Oct 07 '22 04:10

StuartLC