Learn how to scale in and scale out Azure Apps, and what options are available to control the Azure cloud scale.
- [Instructor] One of the advantages of using Azure for your apps, is the ability for your apps to autoscale as necessary. For example, let's pretend your company is having a large sale on your widgets, as more traffic hits your app, the app will scale to meet the new demands. There are two ways we can scale Azure apps, first we can scale out, when we scale out, we increase the number of instances, in the Standard Tier, we can scale up to 10 instances, and in the Premium Tier, the max is 20.
You'll notice that the tier does not change, in this example, everything is at an S1. And keep in mind, this affects all the apps, within that service plan. Next we have the scale up option, and in this scenario, we actually increase the CPU memory, disk space, staging slots, et cetera, by moving up the pricing tier. In this case, we go from a Basic, to a Standard, to a Premium Tier. Let's take a look in Azure on how we actually configure this.
As you can see, I'm in Azure, and I happen to be in the Scaling and Resilience Resource Group. I have a service plan, and I have one Azure web app. Let's take a look at the scaling plan. As we can see, our current plan is a Standard 1 Small. If I wanted to increase this, I would go under App Service Plan, and I'd click Scale Up.
Now I happen to be doing this from, the Azure service plan itself, but you could also do this from the App Blade as well. I'm going to select the S3 Standard Tier. The number of instances stays the same that I can scale up to, in this case, 10. But what I am increasing is the number of cores, and the amount RAM in this instance. I'm going to go ahead and click Select.
Now I could have scaled up to a Premium Level as well. We can see that we've updated that service plan, we'll go back to Overview, we are now at a Standard 1 Large. Our next option is to scale out. That is also under the App Service Plan, I'll open up the Scale Out Blade, and we have a few different options here, first, we can scale manually. So I can go ahead and scale this up to, we'll do three instances, you'll notice the maximum I can go to is 10, because I am in a Standard Tier.
Once I click Save, I'll now have three instances of this app running. Next, I can autoscale by CPU percentage. In this case, we'll automatically scale, up or down, based on the CPU percentage. So I may want to start at four instances, and scale up to 10, and my target range, let's say if we hit, let's say, 50%.
If we fall within the 50 to, 70 range, then our app will automatically scale for us. Don't forget to click Save, and at the bottom here, you'll notice we have notifications for scale actions. You may want to be emailed if your apps are scaling, you can enable that as necessary, and then enter in any additional email addresses of other people who may need to know that these apps are scaling.
Don't forget to click Save. And what I'm going to do is, I'm actually going to close the blade, and then enter it again. And you'll see why in a moment. Now if I go ahead and click on Schedule and Performance Rules, my CPU threshold is already included for me.
If you do not close the blade, this won't show up, and you won't think it's been saved. Just one of those little things to tuck in the back of your head. I can go ahead, at this point, and add in some additional rules if I wish to do so. So if I wanted to add a new rule, so I have my resource, happens to be that service plan that I'm already working in. I can choose my metric, let's say we're going to take memory percentage. My operator, let's go with greater than, but you'll notice that we do have other options here.
And my threshold, let's say 70. And if it stays at a threshold of 70 for 10 minutes, then we're going to increase our count by one, but we could change that action to, increase percent by, increase count two, decrease. And then we have a cool down period of five minutes. One thing to keep in mind here, when you're configuring scale rules, it could take a few minutes for the resources to scale, and become available to your users.
Therefore, you may want to add some wiggle room on either end of that scaling. Go ahead and click OK. And we can also go ahead and add a profile. And here we can set up scaling at a fixed time. Let's make the assumption that on Fridays, we're going to run additional reporting, and we need a little bit more umph, for that. We'll call it Reporting, I know, very descriptive. It's going to reoccur, on Fridays, and we'll start it at 12:00, and we can have the time zone, set here at Pacific.
Because we know we're going to need that extra processing power, I'm going to go ahead and set our target range to six to 10, and then click OK. And that's all there is to it. But before you close this blade, don't forget to click Save. Setting up autoscaling and configuring your app to scale when you need it to, is incredibly easy, using the Azure portal.
- Deploying Web Apps
- Creating App Service plans
- Deploying and moving apps
- Configuring app settings
- Managing Web Apps using PowerShell and CLI
- Configuring alerts
- Enabling diagnostic logs
- Retrieving and streaming logs
- Configuring Web Apps for scale and resilience