Join Mike Benkovich for an in-depth discussion in this video Autoscale, part of Azure Enterprise Development: 2 Application Services.
- [Narrator] Let's talk about hosting plans. Inside of Azure, if we look at our Features over here and scroll down, we'll see that under Settings, we have a couple that are interesting looking. Scale up and scale out. For the scale up, this is where I can choose the hosting plan that I'm running on. This machine right now is running on my hosting plan, which is free because I like having free stuff. And if I look at the hosting plan, I can see that it's actually running pretty high memory percentage. I've got the CPU. I don't have a lot of capabilities that are there but what I want to do is, I want to be able to change that and maybe go with something that has a few more features.
The scale up option is where I can choose the size of machine I want to run and if you remember, when we created this, there's a number of different options, all the way from the free ones, where we have a shared infrastructure and one gig of storage on up. If I want my own custom domain, I have to be at least on the shared plan. Notice the shared plan has a monthly cost. So that's a, if you're using an Azure trial, that's where you're going to use that many credits in Azure. Basic adds SSL. It also adds up to three instances. So I can scale up the number of instances that are running and I have 10 gig of storage on each of these.
It's not a lot but it is enough for some cases. The one that I recommend is going to at least the Standard and here's the reason why. It's because with Standard, you're going to see that we have five slots that we can use for our application, for staging. We have the daily backup. I've been saved a couple times where, I had a backup where I made a change to the website and it stopped working. Maybe I shouldn't do that but, if you don't have the code, you can always go to the backup, be able to restore back and then be up in business.
I can also scale up to 10 instances and I have traffic manager and what that allows me to do is to load the traffic across the different slots if I choose to. So if I wanted to do AB testing, I could have production one and then production two or maybe production two has a new version of the application. So what that traffic manager lets me do is to be able to see the performance and which site is doing a better job. I'm going to go ahead and select Standard. There's also the Premium, which is going to be much bigger, has 20 slots, 50 times you can do backups every day or the PremuimV2, which are going to be even bigger, running SSD.
So depending on the performance you need, you can go out and pick the right size machine, kind of like a T-shirt size. I have one core, two core and four core of each of these different categories and that's just the number of CPU and memory. You have to be able to see if I require that and then you can change it. But I can change the hosting plan at any time, the size. The other way that we can do scale is to have something that tells us we need, not just bigger but we also have the ability to have more. So the scale out options is where I can actually add some rules around how many instances to run.
So, by default, since I'm now on the Standard plan, I have one all the way up to 10 instances. So I could run this as 10 instances when I expect the Super Bowl to go and I have a pizza delivery and I need lots of compute, that would be a great place to use it and I can manually scale it up and I can manually scale it down. I could also add auto scale so I don't have to manually be out here doing this. So, for auto scale, I can create my scale name here, we'll call this my auto scale default rules.
I have the resource group that this is going to live in. But then I can go on and I can say here, I want to set a condition for when I want to scale up. So for instance, I want to scale up when I have a given metric from one instance all the way up to say, five instances. Or I might have a minimum of two instances going up to five and default to say, three. The type of rules you can put on here would be whether I want CPU time or you can also do other metrics, such as memory, data in or data out, if you have the disc Q-link, for instance if the disc is really spinning hard, you can add rules around that as well.
And then you have the time or aggregation, whether you want the min, max, total and then you have for how long, what the value is. So, in this case our rule is going to be when the average CPU, using the average statistic, is greater than 70% for more than 10 minutes, then increase the account by one instance. And then, cool down by five minutes when it comes back down. I could also say increase the percentage of instances or decrease the instance count too. So by doing this now, we've got our metric that we're adding and we can have multiple rules.
You might want to do this on a timer so maybe you want to have the current resource, we want to go out and say when I want to schedule a scale rule. You can do that as well. So you can say, add a scale condition and we're going to say scale up when, we're during the day, from eight a.m., from midnight to midnight. And then specify that maybe during the day I want to be able to make sure I've got more capacity. And I'll have at least two and then scale up and scale down. So with this we can save this and we can put these conditions out there. And we're going to say, go ahead and save and now there's an automation job running that will take care of doing that for us.
You can see the run history as to when this thing was running, when it did the scaling events. You can also see the JSON for the actual rules. This is where I could actually take that out and then edit the actual JSON as well. I can set a notification on this so I can email administrators when this happens. I might also want to send an email directly to the developer, firstname.lastname@example.org and then I might have a web hook so maybe there's a process I want to kick off that says okay, not only are we going to scale but we're going to then change the status of something, saying hey now we've got more different things.
But you can create whatever kind of web hook you want to work with and then you can save those changes. And so that's some of the options we have with the scale up and the scale out.
Learn how to provision new application services, set up autoscaling and deployment options, and use the different application types. Software architect and former Microsoft evangelist Mike Benkovich reviews options such as Continuous Delivery and DevOps Projects, Mobile Apps, and Logic Apps, which connect your applications to business-critical software such as Salesforce, Office 365, Dropbox, and more. He also shows how to stay on top of behavior and performance issues with Azure monitoring tools (including the powerful Application Insights feature), and debug any issues that arise.
- Provisioning application services
- Scaling and deployment options
- Developing for DevOps
- Developing with Mobile Apps and Logic Apps
- Monitoring Azure applications
- Debugging Azure applications