I have implemented autoscaling using the Enterpise Library Autoscaling Block, pretty much as described in the tutorial.
So the first time when I am running load test for my site it's increasing the instance count by one.
And when I am running load again then CPU usage is 100% but it's not increasing the instance count. And when CPU usage is 0% it's not decreasing the instance count.
So what is wrong here?
I have following Rules and Service XML. Rules XML:
<?xml version="1.0" encoding="utf-8" ?>
<rules xmlns="http://schemas.microsoft.com/practices/2011/entlib/autoscaling/rules">
<constraintRules>
<rule name="default" enabled="true" rank="1"
description="The default constraint rule">
<actions>
<range min="2" max="5" target="ServiceWebRole"/>
</actions>
</rule>
</constraintRules>
<reactiveRules>
<rule name="ScaleUpOnHighUtilization" rank="10"
description="Scale up the web role" enabled="true">
<when>
<any>
<greaterOrEqual operand="WebRoleA_CPU_Avg_5m" than="60"/>
</any>
</when>
<actions>
<scale target="ServiceWebRole" by="1"/>
</actions>
</rule>
<rule name="ScaleDownOnLowUtilization" rank="11"
description="Scale up the web role" enabled="true">
<when>
<all>
<less operand="WebRoleA_CPU_Avg_5m" than="40"/>
</all>
</when>
<actions>
<scale target="ServiceWebRole" by="-1"/>
</actions>
</rule>
</reactiveRules>
<operands>
<performanceCounter alias="WebRoleA_CPU_Avg_5m"
performanceCounterName="\Processor(_Total)\% Processor Time"
source="ServiceWebRole" timespan="00:05:00" aggregate="Average"/>
</operands>
</rules>
Service XML:
<?xml version="1.0" encoding="utf-8" ?>
<serviceModel
xmlns="http://schemas.microsoft.com/practices/2011/entlib/autoscaling/serviceModel">
<subscriptions>
<subscription name="My subscription name"
certificateThumbprint="My subscription certificateThumbprint"
subscriptionId="My subscriptionId"
certificateStoreLocation="LocalMachine" certificateStoreName="My">
<services>
<service dnsPrefix="productionservice" slot="Production" scalingMode="Scale">
<roles>
<role alias="ServiceWebRole" roleName="ServiceWebRole"
wadStorageAccountName="targetstorage"/>
</roles>
</service>
</services>
<storageAccounts>
<storageAccount alias="targetstorage"
connectionString="DefaultEndpointsProtocol=https;AccountName=autoscale;AccountKey=storageaccountkey">
</storageAccount>
</storageAccounts>
</subscription>
</subscriptions>
</serviceModel>