Udostępnij za pośrednictwem


Azure: How to Auto-Scale your Web Apps (Web Sites)

Source

MVA: https://bit.ly/laparoundazurewebsites

Articles:

Overview:

You have been implementing your work assignment (see: Problem Statement). After talking to your boss, you find out what the expected usage will be.. Currently you have just one website deployed which uses the Free Shared plan, it appears that your viewers will have heavy usage after certain cultural events like football games, theological meetings and so forth. These occur in different time zones and somewhat randomly. Now you need to adjust your system to meet these requirements, while maximizing your take from the offer made by your boss to give you 25% of the net profit.

Also, once you are done practicing your autoscaling, make sure to switch your app back to the free or cheaper service.  Otherwise you will have to pay for the Standard version, or your subscription will deactivate because you ran out of money.

Process:

  1. Get a beverage and check out the clickbait sites to determine which design seems to be useful.
  2. Open your “Freeloader” site, scroll down to see the images if you don’t have access to Azure, scroll down till you see “Usage”, you see that you are using Shared Infrastructure, duh! Because you are using the “Free” hosting.
  3. You aren’t using a VM, you don’t really need to right? Nope, that Web App (Web Site) needs computational power, it isn’t just Leprechauns and Unicorn Horns running them.

Create your plan:

  1. Guess at the traffic, say 30,000 mobile users could hit the site at one time, how many virtual machines would be required?
  2. Virtual machines come with  Basic and Standard as "instances", Basic requires that you set the number of "instances" manually and Standard allows you to auto scale.  you hit this link to better understand how sizes work in Azure: https://bit.ly/sizeazurevmcloudservices
  3. You take a guess that your most efficient design would be at 6 virtual machines
  4. Because you aren’t sure it 6 virtual machines are enough, you decide to use Autoscale, a feature that you read about at: https://bit.ly/azureautoscale, and set it to 8, because that is 2 to the 3rd power, always a safe bet.
  5. Basic plan does not include AutoScaling, the number of Virtual Machines, referred to as instances must be set manually.
  6. Standard and Premium do support AutoScale, you are going to go with Standard at the recommendation of a friend who has been using Azure for many years. You can always upgrade to premium later, the price seems to be the same, but for now you choose Standard. Although Premium looks like a good deal it is still in preview and you just want this to be stable.
  7. You note that the S1 to S2 to S3 plan doubles the cores and memory, disk stays the same. For no really solid reason you go with S2 Standard.

Now what do you do?

  1. Change your hosting plan to Standard, although you are considering Premium, the “subject to availability” statement worries you. That might change in the future.
  2. You switch to the Azure Portal from the Azure Preview Portal to make sure that the scale by metric is set to CPU, as your friend advises you.
  3. Naturally you are a little confused by the difference in the Azure Preview Portal and the Azure Portal. You note this down as something you want to make sure you get a grasp of.
  4. Most of the literature on Azure.Microsoft.com is still using the Azure Portal and not the Azure Preview Portal, which makes sense as the Azure Preview Portal has just rolled out.
  5. Azure Preview Portal: The correct setting for this would be to use the “ CPU percentage” (see step 8 for image)
  6. Azure Portal you would set the Scale by Metrics from None to CPU
    • clip_image002
  7. Set Instance count to between 1 and 8, you can change it later if your logs indicate that you don't go that high or for other reasons, you can also move it up to 10.
    • clip_image004
  8. In the Azure Preview Portal
    •  clip_image006
  9. Instances and Target range is discussed in depth at the article:
  10. Scroll down to see the Azure images, below the conclusion.

Conclusion

You have successfully switched your Web App (Web Site) over to using VMs, you chose the S2 Standard over the P2 Premium mostly on advice from a friend. The new system will cost $89.23 (US 2015) but it will act to be efficient because you have selected autoscale using CPU percentage for performance.

Also you used both the Azure Portal and the Azure Preview Portal to do your configuration. 

 

Step by step Azure images:.

Here is your Freeloader site using the free hosting plan.

You will need to upgrade it to the Standard plan so that you can use the autoscale. Autoscale does raise an expense over using the Basic plan, but saves money with loads that are random in nature. Or you don’t have good traffic data on.

Click on the Pricing Tier on this blade.

You may need to scroll down to see the usage part of the blade

clip_image008

Here are the pricing tiers, I didn’t show you Basic, it won’t meet your requirements.

The Premium (preview) looks compelling, but that “preview” word worries you. So you pick

S2 Standard. Your storage requirements are not well defined, you can always upgrade later.

clip_image009

Now your usage box on the Web App (Web Site) initial blade looks like the image below.

Note:

The Freestuff App Service Plan is the service plan we made up when creating the Freeloader Web App (Web Site) .

That might be confusing since you will now pay the $89.28 US (2015).

Oh well, let this be a lesson to you to do good naming of things. Others are going to read this. It even confused me when I was looking at it.

clip_image010

Now configure your scaling, there are three selections, use CPU Percentage on the Scale Setting page. The instances setting is the number of VMs. This is the image from the Azure Preview Portal.

clip_image011

You may want to use the Azure Portal then it will look like this, you will need to change the Scale by Metric toggle switch from None to CPU. You could also change your app service plan pricing tier here as well. Use the Azure Preview Portal when possible though.

Your friend likes the classic Azure Portal so you follow their instructions.

clip_image013