Azure的ApplicationManifest.xml中的CpuPercent如何工作?

时间:2017-06-21 20:08:03

标签: xml azure limit azure-service-fabric service-fabric-stateful

我目前正在学习如何限制天蓝色服务的CPU负载。我基本上制作了一个叉炸弹,并且我的目标是限制CPU使用率,为系统的其余部分留下一小部分。

我在资源治理策略中找到了“CpuPercent”值,但在发布到群集后我还没有看到效果。应用同一行中的内存限制,但CPU使用率仍然猛增。我也可以将程序限制为一定数量的内核,但这不是我想要的,因为在正常操作期间会使处理器的很大一部分空闲。

这是我项目的ApplicationManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="ForkingCloudType" ApplicationTypeVersion="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <Parameters>
    <Parameter Name="Stateful1_MinReplicaSetSize" DefaultValue="3" />
    <Parameter Name="Stateful1_PartitionCount" DefaultValue="1" />
    <Parameter Name="Stateful1_TargetReplicaSetSize" DefaultValue="3" />
  </Parameters>
  <!-- Import the ServiceManifest from the ServicePackage. The ServiceManifestName and ServiceManifestVersion 
       should match the Name and Version attributes of the ServiceManifest element defined in the 
       ServiceManifest.xml file. -->
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="Stateful1Pkg" ServiceManifestVersion="1.0.0" />
    <Policies>
      <!--ServicePackageResourceGovernancePolicy CpuCores="1" /-->
      <ResourceGovernancePolicy CodePackageRef="Code" MemoryInMB="2200" CpuPercent="20" />
    </Policies>
  </ServiceManifestImport>
  <DefaultServices>
    <!-- The section below creates instances of service types, when an instance of this 
         application type is created. You can also create one or more instances of service type using the 
         ServiceFabric PowerShell module.

         The attribute ServiceTypeName below must match the name defined in the imported ServiceManifest.xml file. -->
    <Service Name="Stateful1">
      <StatefulService ServiceTypeName="Stateful1Type" TargetReplicaSetSize="[Stateful1_TargetReplicaSetSize]" MinReplicaSetSize="[Stateful1_MinReplicaSetSize]">
        <UniformInt64Partition PartitionCount="[Stateful1_PartitionCount]" LowKey="-9223372036854775808" HighKey="9223372036854775807" />
      </StatefulService>
    </Service>
  </DefaultServices>
</ApplicationManifest>

这个“CpuPercent”打算如何使用?有没有文件?

1 个答案:

答案 0 :(得分:0)

在与Microsoft技术人员来回反复之后,我被告知CpuPercent仅在容器内部运行。

但是,我还没有找到或被引导到任何官方文档,所以如果有人能够挖掘它,那么我将把它作为公认的答案。