Microsoft | patterns & practices | Developer Network | Enterprise Library | Acceptance Testing Guide | Personal Site
In the Windows Azure Autoscaling Application Block (codenamed “WASABi”) we have support for scale groups. These are for convenience when there are many rules that target multiple roles. With scale groups we can reduce the number of autoscaling rules we must create and manage. In defining constraint or reactive rules, instead of specifying a role as a target, we can simply specify a scale group. Note, a scale group can include targets that refer to roles in different hosted services.
Here’s an example of a scale group definition (which we would put in the service model configuration file):
<scaleGroup name="ScaleGroupB"> <roles> <role roleAlias="Billing" ratio="3" /> <role roleAlias="InvoiceReporting" ratio="1"/> <role roleAlias="Audit" ratio="1"/> <role roleAlias="WebRole" ratio="2"/> </roles> </scaleGroup>
As you can see, each target role is assigned a ratio. The scaler uses these ratios to calculate the new instance count for the role whenever a scaling operation takes place. The following table shows the effect of scaling the scale group by an increment of 2.
Target
Initial instance count
Instance count after scaling by an increment of 2
Billing (in Service Host A)
6
12
Reporting (in Service Host B)
2
4
Audit (in Service Host C)
WebRole (in Service Host B)
8
The result is calculated as follows: (Initial instance count) + (Increment * Ratio)
Keep in mind, that scale groups are a convenience only. There’s no transactional reinforcement and no guarantee to preserve the ratios between the role instances. For example, a constraint rule may limit the number of instances suggested by a reactive rule for some roles in a scale group, or a human operator may manually change the number of instances of one or more roles independently of your autoscaling rules.
We can use multiple scale groups with the same members to apply different ratios at different times. For example, in addition to the ScaleGroupA above, let’s define the following scale group:
<scaleGroup name="ScaleGroupB"> <roles> <role roleAlias="Billing" ratio="1" /> <role roleAlias="InvoiceReporting" ratio="1"/> <role roleAlias="Audit" ratio="1"/> <role roleAlias="WebRole" ratio="3"/> </roles> </scaleGroup>
Now we could specify two constraint rules:
Rule name
Timetable
Rank
Default rule
Always active
1
ScaleGroupA
Batch processing rule
Sundays between 02:00 and 04:00
20
ScaleGroupB
Both rules target the same roles, but apply different ratios. The batch processing constraint rule will override the default constraint rule on Sundays between 02:00 and 04:00 in the morning and use the ratios defined for the ScaleGroupB.