none
ServicePackageResourceGovernancePolicy CpuCores

    Question

  • Hi there,

    Background:
    We are restricting the number of CpuCores used by a service by using the ServicePackageResourceGovernancePolicy in ApplicationManifest.xml 
    e.g.
      <ServiceManifestImport>
    ..
        <Policies>
          <ServicePackageResourceGovernancePolicy CpuCores="[Web1_CPUCores]" />
        </Policies>
      </ServiceManifestImport>

    The parameter Web1_CPUCores is overridden for each of the environment. 

    Question:
    One environment has only 2 cpu cores available so we don't want to apply the policy for that environment. With empirical testing we found that when we set the CpuCores to 0 the policy doesn't get applied
    e.g. Get-ServiceFabricClusterLoadInformation shows the ClusterLoad as 

    LoadMetricInformation     :
    ...
                                LoadMetricName        : servicefabric:/_CpuCores
                                ClusterCapacity       : 6
                                ClusterLoad           : 0
                                ClusterRemainingCapacity : 6
    ...

    Please confirm this is correct and point to any documentation confirming this.


    Tuesday, May 7, 2019 2:28 AM

All replies

  • Have you checked the doc on this to see if it answers your questions? 

    https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-resource-governance

    Tuesday, May 7, 2019 9:21 PM
    Moderator
  • Yes, But The above link doesn't mention about zero
    The "C:\Program Files\Microsoft SDKs\Service Fabric\schemas\ServiceFabricServiceModel.xsd" says cpucores should be a positive number.

    ...

      <xs:complexType name="ServicePackageResourceGovernancePolicyType">
        <xs:attribute name="CpuCores" type="xs:string" use="optional" default="0">
          <xs:annotation>
            <xs:documentation>CPU limit in number of logical cores. Must be a positive integer.</xs:documentation>
          </xs:annotation>
        </xs:attribute>
    ...

    Wednesday, May 8, 2019 12:15 AM
  • Got it. So yes, as you found it does need to be a positive number. So applying a 0 should effectively do nothing. That might be good to note in the document though. 

    You can actually open a issue directly against the doc if you scroll to the bottom of it:

    That way if you have a suggestion we can work directly with the content authors and product teams to get more info added and make the docs better. 

    Wednesday, May 8, 2019 1:04 AM
    Moderator
  • Thanks for the confirmation.
    I have also sent the document feedback. 
    Thursday, May 9, 2019 12:36 AM
  • Thanks! I responded to that github issue so we will take a look :) 
    Thursday, May 9, 2019 12:46 AM
    Moderator