I'm trying to setup an autoscaling solution for my Azure apps. I've got it to react to constraintRules but just can't make it react to reactiveRules.
I'm using diagnostics to log all the messages from the Autoscaling (using P&P Autoscaling Block) - so I can see that the autoscaler sees my reactive rules, but the target is not being identified. Such as this:
<TraceSource>Autoscaling General</TraceSource>
<Object>Rule match.
[BEGIN DATA]
{"EvaluationId":"67281173-085f-49a1-95f8-0b9c50a4de7d",
"MatchingRules":
[{"RuleName":"Default constraints for all roles",
"RuleDescription":"SLA rule",
"Targets":["JobsRole","RESTAPI","Web"]},
{"RuleName":"scaleWebApi",
"RuleDescription":"Scale up when cpu average over 5%",
"Targets":[]},
{"RuleName":"scaledownWebApi",
"RuleDescription":"Scale down when cpu avg under 5%",
"Targets":[]}]}
</Object>
Where the reactive rules are defined as:
<reactiveRules>
<rule name="scaleWebApi"
description="Scale up when cpu average over 5%" rank="2" enabled="true">
<when>
<any>
<greater operand="RESTAPI_CPU_Avg" than="5" />
</any>
</when>
<actions>
<scale target="RESTAPI" by="1" />
</actions>
</rule>
<rule name="scaledownWebApi" rank="2" enabled="true"
description="Scale down when cpu avg under 5%">
<when>
<all>
<lessOrEqual operand="RESTAPI_CPU_Avg" than="5" />
</all>
</when>
<actions>
<scale target="RESTAPI" by="-1" />
</actions>
</rule>
</reactiveRules>
My constraintRules - they DO work
<constraintRules>
<rule name="Default constraints for all roles"
description="SLA rule" enabled="true" rank="0">
<actions>
<range target="JobsRole" min="1" max="5" />
<range target="RESTAPI" min="1" max="5" />
<range target="Web" min="1" max="5" />
</actions>
</rule>
</constraintRules>
and my service config file (only the part of the roles)
<services>
<service dnsPrefix="<dns>" slot="Production" scalingMode="Scale">
<roles>
<role alias="JobsRole" roleName="JobsRole" wadStorageAccountName="<mystore>" />
<role alias="RESTAPI" roleName="RESTAPI" wadStorageAccountName="<mystore>" />
</roles>
</service>
<service dnsPrefix="<dns>" slot="Production" scalingMode="Scale">
<roles>
<role alias="Web" roleName="Web" wadStorageAccountName="<mystore>" />
</roles>
</service>
</services>
What could be the problem and how can I try and make sense out of it?
I can’t spot anything wrong in your config. But please make sure the target name is correct. It should be the role name. I would like to suggest you to check http://msdn.microsoft.com/en-us/library/hh680945(v=PandP.50).aspx to see whether it helps.
Best Regards,
Ming Xu.