How does Azure Service Plan load-balance traffic with different apps - azure

I am trying to understand better how Azure App Service Plan (ASP) load-balances the traffic when multiple/different App Services are deployed in it.
Let's assume my ASP is made of 2 nodes (VMs or instances) and I deploy 2 apps (total 4 app instances running) and with following URL:
https://app1.azurewebsites.net
https://app2.azurewebsites.net
I know that there are ASP front-ends acting as load balancers. So here if I understand correctly it is like when I have a web-server hosting different web-sites and address distinction is based on virtual hostnames (which are the URL above). Right?

App Service is a multitenant service, so it uses the host header in the request to route the request to the correct endpoint. The default domain name of App Services, *.azurewebsites.net (say, contoso.azurewebsites.net), is different from the application gateway's domain name (say, contoso.com). ref.1
When using App Service, you can scale your apps by scaling the App Service plan they run on. When multiple apps are run in the same App Service plan, each scaled-out instance runs all the apps in the plan.
Apps are allocated to available App Service plan using a best effort approach for an even distribution across instances. While an even distribution is not guaranteed, the platform will make sure that two instances of the same app will not be hosted on the same App Service plan instance.
The platform does not rely on metrics to decide on worker allocation. Applications are rebalanced only when instances are added or removed from the App Service plan.
You can also now do Per-app scaling, which can be enabled at the App Service plan level to allow for scaling an app independently from the App Service plan that hosts it. This way, an App Service plan can be scaled to 10 instances, but an app can be set to use only five. ref.2

Related

Azure app service scale out and changes in application gateway

I am using azure application gateway and azure app service. I have enabled scale out in app service. I have added app service private ip address to application gateway, Will it changes during scale out ? Will it created another app service or the service itself handle the load balancing?
A scale-out operation is comparable to making several copies of your website and adding load balancing to divide the load among them. There is no need to configure load balancing separately when scale out appear in Azure app since this is already provided by the platform
In azure app service scale out as increasing number of instances, the more number of instances the application will able to process the user request very smoothly and you need to worry about the load balancing azure will take care of load distributing among the instances
when number of scaled-out instances actions in single ip address if the last app in a resource group and region combination has been altered, deleted, the deployment unit is recreated it may change.
For your Reference :
How IP addresses work in App Service

Deploying multiple web Apps on Azure App Service.. Is there any implications of this

I have a client coming on board to Azure from other cloud service provider. They would like to host up to 10 web apps on Azure and cost is really an issue for them.
Normally I'm suppose to create VM's that would host each of these web Apps; but they can't afford the price. Hence the choice of deploying all of them on the same Azure App service plan.
I think Azure App service offers only 50gb storage. The 10 Web Apps would require storage capacity far more than 50gb; is it scalable or can we link each of these Apps to an Azure storage account. And also is there any implications for deploying multiple web Apps on an Azure App Service plan
An App Service Plan is capable to run multiple Web Apps, each in its own sandbox. It's like a VM but as a PaaS service. Note that the storage included in the plan will be shared across all Web Apps so you'll have to use Azure Storage if you want to store more data.
An App Service Plan is designed to handle multiple web apps/Function apps, use BLOB Storage or similar for your data it will scale to whatever you need, depending on your needs you can add further services like Azure Front Door to load balance multiple apps on multiple app service plans
One important thing to remember is that the app service plan has limitations with outbound connections so even if each of your webapps are not so busy the sum of them all might bring you over the limit so be very careful how you handle your outbound connections.

Use case for Azure App Service Deployment Slots - variation on versions of apps

I read about the Deployment Slots on Azure App Service, and all docs and articles point out that these can be used for something like Prod and Stage versions of an app, with a swap of Stage to Prod to promote it to Prod after testing.
But is that the only use case? For example, we have a web app hosted on Azure App Service. Now we need to make a variation of that app for a specific purpose. It will never be swapped with the production slot. It will just co-exist as basically two separate apps.
Can deployment slots be used like this? Any downsides? It seems to me to be a way to host two or more web apps in an App Service without creating multiple App Services (therefore lower cost).
Technically I believe it is possible to do what you are suggesting because each deployment slot does host a fully functional version of your application and you can access specific slots using this routing method. You would simply deploy each environment to its own slot and never swap them.
You can create additional web applications at no cost. You are only paying for the App Service Plan, and you can have as many web apps running on that plan as you want, so you would be better off creating a separate App Service for each of your environments, and since they are all non-production, you can safely run them all in the same App Service Plan.
You can deploy multiple separate WebApps under an App Service Plan. All those WebApps (/websites) will have their own separate default domain (FQDN) and also you can set custom domain for each of those WebApps.
App Service – Service which enables you to build and host web apps, mobile back ends, and RESTful APIs.
Apps– Your individual Apps (WebApps), these apps run in App Service Plan.
App Service Plan - An App Service Plan (ASP) defines a set of compute resources for a web app to run.
Since you pay for the computing resources your App Service plan allocates, you can potentially save money by putting multiple apps into one App Service plan. You can continue to add apps to an existing plan as long as the plan has enough resources to handle the load. However, keep in mind that apps in the same App Service plan all share the same compute resources.
If those are separate WebApps, it would be easier to manage separate WebApps than via virtual subdirectories/paths or hostname, or sub-domains. Using App Service Plan feature (provision many apps under the tier) to save cost.
Downsides:
There is a limitation for hosting number of apps in an app service plan bases on plan Tiers you are using, like you can host up to 100 apps in a same app service plan if using the Shared Plan Tier and in the Free Tier, you're charged per app in the app service plan. Refer this for more details.
Azure maintenance requires servers to restart at least once a month or more. If all your apps are on a shared plan, a patch reboot can mean the entire system is down and that all apps compete for resources when starting up simultaneously
Deployment and restarting of apps can cause CPU spikes for the plan (which is a server). If your apps are performance sensitive and you deploy often, you might want more separation.
Note:
Use separate plans as environment boundaries, so a production plan separate from a test plan. "Test" apps go on test plan, "Prod" apps on production to prevent testing from impacting users.

What is the Best way to Load balance Azure web apps deployed under one Azure App Service plan

I have 1 Webapp running under same App service plan. As I am using a premium Azure app service plan with 15 instances, We are consuming only 10 percent of CPU. So to increase more availability and responsiveness of our app, I was planning to deploy one more instance of same app with a different name under same App service plan.
So now I am running my-app and my-app01 under 1 app service plan. Now I want to distibute the incoming traffic between this 2 apps.
As this app's are running under on app service, they are running on same location. So Azure Traffic manager doesn't allow the endpoints from same location. To by pass this I have used Traffic manager nested nedpoint to list my both app endpoints under one traffic manager.
then I have added my custom domain name to traffic manager as a CNAME record mapping.
myapp.abhisqs.com -> abhisq.trafficmanager.net -> (my-app.azurewebsites.net , my-app01.azurewebsites.net)
After doing this I am not able to open my app by hitting https://myapp.abhisqs.com/pages/default.aspx from Url, it was throwing 403 error. So I added a hostname(myapp.abhisqs.com) and SSL binding for my-app. Then I was able to open my app by using the https://myapp.abhisqs.com/pages/default.aspx.
So Now my other app instance my-app01 doesn't have a Hostname and SSL binding, So if my primary app (my-app) is off, then I am not able to open the app UI ( fails with error 403). Also from Azure portal I am not able to add host name and SSL binding to my second app which is running under same app service plan. It throws error "the host name 'myapp.abhisqs.com' is alredy configured for my-app so first remove that then configure with this."
So my question is what is best way to have multiple apps under same service plan, load balanced under one single custom domain name.

can we use load balancer on a two app services in azure

I am creating a network with 2 app services, containing 2 slots each
I know the load balancers are designed to work with VM's, but I am wondering if it is possible to place a load balencer on these 2 app services to balance the load between them, Is it possible to do so??
When you Scale your Web App you add instances of your current pricing tier and Azure deploys your Web App package to each of them.
There's a Load Balancer over all your instances, so, traffic is automatically load balanced between them. You shouldn't need a Virtual Machine for this and you don't need to configure any extra Traffic Manager.
You may want to refer: scale your app in Azure App Service for more details.
but I am wondering if it is possible to place a load balencer on
these 2 app services to balance the load between them, Is it possible
to do so??
According to your description, maybe you are looking for Azure application gateway(layer 7).
Azure application gateway works at the application layer (Layer 7 in the OSI network reference stack). It acts as a reverse-proxy service, terminating the client connection and forwarding requests to back-end endpoints.
Azure application gateway support HTTP, HTTPS and Websockets.
Here is the features offered by each service:
More information about Application gateway, please refer to this article.
Maybe little late but I guess this what you are looking at
Scale Out- A scale out operation is the equivalent of creating multiple copies of your web site and adding a load balancer to distribute the demand between them. When you scale out a web site in Windows Azure Web Sites there is no need to configure load balancing separately since this is already provided by the platform.
https://azure.microsoft.com/en-us/blog/scaling-up-and-scaling-out-in-windows-azure-web-sites/

Resources