Configuring an App Service to Auto Scale based on CPU load

Today we will look at the auto scaling feature in the Azure App services. Auto scaling can be done in either Scale up mode or Scale out mode. Scale up mode is vertical level of procedure by increasing the App service compute components. ie CPU and Memory. Scale out is the horizontal level of increasing resources by adding more number of VMs.

We will see how to configure the Scale out method for an app service and perform some stress test to see how it will behave.

* You need to note that the auto scale feature is available from the Standard level of App service plan. So the feature is not available if your app service is on Free, Shared and Basic plan.

1. First thing you will do is to go to the Scale out (App Service plan) under the Settings option on the App service that you want to configure. Then click on the “Enable autoscale” button.

2. Then give a name to Auto scale settings name and select the “Resource Group”

3. Next you will need to create a new “Auto Scale Condition” so select the Auto scale mode as “Scale based on a metric” Then configure the rule as below. By setting the Instance limit maximum to 5 and then next you need to add Rule as below.

Here we have mentioned the criteria as a CPU percentage as the Metric and configured the threshold as 80% of CPU load for 5 minutes will trigger the autocale and it will increase the instance by one VM. Once these fields are populated Add the Rule. This will create a new Condition. You can create more conditions based on your business requirements. Finally Save the Autoscale Rule.

4. Once the settings are saved click on the “Notify” option on the blade and enable “Email Administrators” notification.

5. Now we have completed all the required configuration and now it’s time to give generate some load on the web app. So here I am running the stress test on the URL. The tool does a 1000 threads per second. (I have used a tool named West Wind Web Surge)

6. While the tool is running you have check the “Scale out” option on the app service and on the recent activity list you can see the autoscale operations occured during the period. Now click on of the event and check the details. So the event will give more information about the activity that it has done.

 

7. Finally, if you have successfully configured you will also receive a notification as below.

Leave a Reply

Your email address will not be published. Required fields are marked *