1
我目前在學習如何限制天青服務的CPU負載。我實際上製作了一個叉形炸彈,並且我的目標是限制CPU使用率,爲系統的其餘部分留下一小部分空間。Azure的ApplicationManifest.xml中的CpuPercent如何工作?
我在資源管理策略中找到了「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」 打算?有沒有文件?