Earlier I have discussed the various type of scaling options (vertical scaling, horizontal scaling) that we have available. In this particular article I am going to focus on horizontal scaling, more specifically how I can scale my website from the azure portal to handle the extra spikes and scale it down again in off season to minimize the overall cost.
The first pre-requisite of scaling is to upgrade the pricing tier for the target website. The minimum pricing tier that let me scale my web app is basic tier which indicates that I can’t enjoy the scaling facilities if my web app is running in either free or shared tier.
Upgrading the pricing tier is easy. All I have to do is to open the Settings blade for my desired web app and then I have to click the App Service Plan which will open up a new blade from where I have to choose the Pricing tier.
The following list shows the maximum available instance count possible (at the time of this writing) for any given tier .
|Pricing Tier||Instance Count|
Once my webapp is running under any (basic, standard, premium) of these tier I can click the Scale option from Settings blade which will open up the Scale blade. From there I can slide the Instances bar from left to right to increase the number of instances, Once I am done with this setting I have to hit the Save button.
Figure below tells that, right now 3 instances are running for this webapp and I have asked to increase the instance count to 7.
Its good that azure let me change the instance count manually. But sometime manual scaling (setting the instance value) does not make any sense for a given situation. Auto scaling may be more suitable, more preferable.
Auto Scaling : Auto scaling increase the instance count up or down automatically according to conditions defined. During demand spikes to maintain performance it increase the instance count and when there is not enough load it simply decreases the instance count to reduce overall costs. Applications that have stable demand patterns or that experience hourly, daily, or weekly spikes are the scenario where auto scaling should be implemented.
The following visualization shows the auto scaling feature in action. When there don’t have enough incoming requests only one instance are serving the client.
But if suddenly request increases from client end and one single instance is not able to handle, process all requests smoothly then it will increase the instance count to response smoothly. This is what auto scaling is!
Configuring auto scale rule is as easy as we did manual scaling. First I have to open the Scale blade and from the drop down of SCALE BY option I have to choose CPU Percentage. Then I have to move the two sliders to define the minimum and maximum number of instances and Target Range to scale automatically.
If I want I can also schedule the time (always, recurrence, fixed date) and set some performance rule so that auto scaling works on my defined way.
Following figure show the options from where I can set rule.
Even with a single instance count site which are running in premium mode benefits with high availability and greater robustness. Increasing the premium instance count (scale out) ensures greater performance and fault tolerance.
Scaling is one of the key feature of cloud. Azure team makes this feature highly customizable to fit business need. As you can see from the portal itself you are allowed to have maximum 20 instances which are enough for most businesses, but If your business requires more then 20 instances then you could either call the Microsoft support center or could knock the account manager at Microsoft directly to allocate you more instances.
Good Reads :
- Azure documentation : Web site scale
- Scaling is never a problem
- How to scale cloud applicatioin
- Code to scale in the cloud