我正在尝试为我的 Azure 应用程序设置自动缩放解决方案。我让它对约束规则做出反应,但不能让它对反应规则做出反应。
我正在使用诊断记录来自自动缩放的所有消息(使用 P&P 自动缩放块) - 所以我可以看到自动缩放器看到了我的反应规则,但目标没有被识别。比如这样:
<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>
其中反应规则定义为:
<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>
我的约束规则——它们确实有效
<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>
和我的服务配置文件(仅角色的一部分)
<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>
可能是什么问题,我该如何尝试并理解它?