1

我已经使用 Enterprise Library Autoscaling Block 实现了自动缩放,与教程中的描述非常相似。

因此,当我第一次为我的站点运行负载测试时,它会将实例计数增加一个。

当我再次运行负载时,CPU 使用率为 100%,但它并没有增加实例数。当 CPU 使用率为 0% 时,它不会减少实例计数。

那么这里有什么问题呢?

我有以下规则和服务 XML。规则 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>

服务 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>
4

0 回答 0