Поделиться через


Defining Throttling Autoscaling Rules

Retired Content

This content and the technology described is outdated and is no longer being maintained. For more information, see Transient Fault Handling.

patterns & practices Developer Center

On this page:
Usage Notes

The Autoscaling Application Block supports two autoscaling mechanisms: instance autoscaling, whereby the block changes the number of role instances based on a collection of constraint and reactive rules, and throttling, whereby the application modifies its own behavior to change its resource utilization based on a set of reactive rules. Two examples of application throttling are switching off non-essential features and gracefully degrading its UI.

If your application uses throttling autoscaling, the developers of your Microsoft Azure application will have implemented the throttling behavior in the application. As an administrator, you must define the autoscaling rules that trigger the throttling behavior. For example, the web role in your Azure application may have three levels of UI functionality: "Normal" mode, when the full set of UI features are available; "Level1" mode, when some non-essential UI features are unavailable; and "Level2" mode, when all non-essential UI features are unavailable. You can switch between the modes by using the UIMode service configuration setting.

The following code snippet shows a set of sample reactive rules that automatically switch your application between the different UI modes.

<reactiveRules>
  <rule name="Normal UI Mode" enabled="true" rank="10">
    <when>
      <lessOrEqual operand="CPU_05_RoleA" than="50"/>
    </when>
    <actions>
      <changeSetting target="WebRoleA" settingName="UIMode" value="Normal"/>
    </actions>
  </rule>

  <rule name="Level 1 UI Mode" enabled="true" rank="10">
    <when>
      <greater operand="CPU_05_RoleA" than="50"/>
    </when>
    <actions>
      <changeSetting target="WebRoleA" settingName="UIMode" value="Level1"/>
    </actions>
  </rule>

  <rule name="Level 2 UI Mode" enabled="true" rank="20">
    <when>
      <lessOrEqual operand="CPU_05_RoleA" than="80"/>
    </when>
    <actions>
      <changeSetting target="WebRoleA" settingName="UIMode" value="Level2"/>
    </actions>
  </rule>
</reactiveRules>
  
<operands>
  <performanceCounter alias="CPU_05_RoleA" source="WebRoleA" 
    performanceCounterName="\Processor(_Total)\% Processor Time" timespan="00:05:00" aggregate="Average"/>
</operands>

The rule named "Level 2 UI Mode" has a higher rank than the rule named "Level 1 UI Mode" because both rules are triggered if average CPU utilization is above 80%. In this case, you want to ensure that the block only executes the action for the rule named "Level 2 UI Mode."

Usage Notes

  • Throttling autoscaling rules can have an almost immediate effect on your Azure application because, unlike instance autoscaling rules, there is no delay while Azure starts a new role instance.
  • Unlike instance autoscaling, there is no cool-down period. The next time the block evaluates your autoscaling rules, it could set new configuration setting values.
  • If the scalingMode setting for the hosted service in the service information configuration is set to "Notify," then the configuration setting will not be changed.
  • The target of the changeSetting action can be either a role alias or a scale group name.

Next Topic | Previous Topic | Home

Last built: June 7, 2012