The Benefits of Auto-scalability in Microsoft Azure™ Web Apps

Posted on Apr 05, 2016 in Technical  | No comments

Author: Sarah Wood Date: 06/04/2016

Wouldn’t it be wonderful if your website environment grew and shrank in response to real-time demand? So, instead of having a server room full of expensive hardware that is running “just in case”, you could have a magical machine that simply makes itself bigger or smaller as required during the life of your website. While this sounds somewhat fantastical, it is in fact just what Microsoft Azure™ can offer your business.

So, no more spending endless amounts of money on hardware upgrades. No more delays for your audience, while your IT department orders, acquires, and installs new equipment to handle excess short term demand. No more worrying that your website simply won’t handle the traffic of an upcoming media campaign. Now, with Microsoft Azure™ technology platform, you have the ability to rapidly scale your application in the cloud in response to changes in demand. And all this at the click of a mouse button.

There are two primary approaches to this time and money saving technology in Azure; offered to you out of the box, and via a very simple interface in your Azure Web App dashboard.

Scaling up – Increase the power of your instance

Available in Basic, Standard, and the new Premium pricing tiers, scaling up allows you to increase the power of your cloud based web app to suit your needs. In real world terms, this is similar to moving your non-cloud server to a larger physical server. In Azure, rather than having to purchase the larger server, set it up, and configure your website in the new environment, you can switch between “Small” (1 core and 1.75GB memory), Medium (2 core and 3.5GB memory), or Large (4 core and 7GB memory) instances, all with the simplest of changes to a dropdown list.

This allows your environment to grow with your website’s requirements, without the large and costly task of upgrading your physical environment.

Scale up

Scaling out – Multiply your site, as and when required

Available in Shared, Basic, Standard, and the new Premium pricing tiers, scaling out allows you to add more instances of your website to handle times of greater demand. In real world terms, this is similar to creating multiple copies of your site, and load balancing your traffic amongst those instances:

  • In Shared mode, you can increase your number of instances from 1 – 6 copies on a shared infrastructure
  • In Basic mode you can increase your number of instances up to 3, and combine this with Scaling up to create an environment that suits your needs;
  • In Standard mode you can increase your number of instances to.
  • The Premium pricing tier offers you the greatest flexibility with 1-20 instances made available.

With all these options, your load balancing is automatically handled by the Azure environment, with no expensive load balancing software, or tricky configuration required to allow your audience a seamless website experience.

Automatic Scaling – Scale out without lifting a finger

An additional feature of the Standard and Premium app service is Scale on Demand. After some initial configuration, you won’t have to lift a finger to increase your instances for greater website performance, or to decrease your instances to save yourself money when the additional compute power is no longer required. Azure Web Apps offer a number of mechanisms for configuring auto-scalability.

1.       Scale by CPU percentage

This setting allows you to specify a target CPU range, and a max and min number of instances to scale to. This means that, if your CPU usage increases above the maximum target set, Azure will automatically add an additional instance up to the max number of instances configured. Then, when the CPU usage drops below the minimum level set, Azure will reduce the number of instances. This setup is ideal for ensuring that unexpected spikes in activity are catered for, while not blowing your web budget for the month, as you are able to control the greatest number of instances that will be brought into play.

Scale out by Metric

2.       Scheduled scale settings

The power of the auto-scale configuration is truly brought to life with the use of scheduled scaling. Out of the box Azure allows you to perform different scaling out/in during the day and night, or for weekdays vs weekends. This means, if you know you have a peak in traffic during your work hours, you can increase the number of web instances for just those hours. Or, if you have a requirement for ensuring quick response times during the day, but during the night you are less concerned about the speed of requests as you’ve discovered this traffic seldom leads to increased revenue, you can adjust your scale accordingly.

In addition to the general day-to-day flexibility, should you have a campaign running for a few weeks which will increase traffic to your site, you can configure your own “hot-times” to ensure that your valuable campaign doesn’t fail due to the performance of your website when your campaign traffic starts slamming it. And after your campaign ends, there’s no need to get rid of all the additional hardware you would’ve had to setup in a non-cloud based environment. Your standard day to day scheduling will simply fall into place.  Without you having to lift a single finger.

The portal also allows for even further advanced configuration of the scale rules you wish to setup, allowing you to set rules that combine both timing and metric scaling, adding a great amount of flexibility to the automation. This enables you to combine the power of both scheduled scaling and scaling by performance, to get the perfect solution for your website.

The metrics available to scale against are:

  • CPU percentage
  • Memory percentage
  • Disk queue length
  • Http queue length
  • Data In
  • Data Out

The portal interface even shows you the history of your web app and indicates the threshold specified, so you can see how often your rules will come into play on your site.

3.       Use PowerShell to Scale

This additional scale feature is certainly worth a mention for the developers out there. Sometimes the scaling options above are simply not enough to cover the complexity of a website’s requirements. Furthermore your website may well be fine to run on the free tier, which doesn’t have the auto-scaling scaling option, for 99% of the time. When the site traffic does get busy, wouldn’t it be nice to switch it up to the Standard tier and take advantage of the auto-scaling mentioned above? Well, using powershell, you can! Basically the process involved requires the use of alerts and azure automation to indicate your site is under stress, and responding to that alert by setting up the scale rules and switching your site to the Standard tier to make use of it.  Then, once your influx of traffic has subsided, detecting this change again to revert your site to the free tier. This automation is fantastic, and not only for the developer who no longer needs to login to Azure on Christmas day to make any manual changes when you notice your site is not responding as it should! It also saves you money, as you are no longer required to pay additional monthly costs just in case.

Scale out by metric and schedule

Azure auto-scale in a nutshell

Advances are happening all the time in Azure, and they save you money. No more need to fill up a server room to ensure your site is performing as you need it to. No more developers on call waiting for increased traffic that may not arrive. With the monitoring, automation, and scaling options that Azure gives you, your site should be able to run quickly and smoothly, without unnecessary additional cost. All you need to know is what causes your website to slow down, and setup rules to respond to that metric. The intuitive interface allows non-technical users to manage their own rules, while the power of Azure allows advanced users to use familiar tools to automate the behaviour of the site. All this, without having to lift a single finger.