Search code examples
azureazure-service-fabricservice-fabric-stateless

Using Windows Jobs with Service Fabric


I have a microservice deployed to a Service Fabric Cluster. The service is misbehaving in its CPU consumption and degrading performance of other services running along side it on the same VM. We have diagnostic information that is leading us down a path to fix it, however in the mean time we need it running in a governed state until we can verify the fix. Our cluster is not set up as of right now to work with Containers, and that may be a longer term solution for things like this in the future. However, in the short term, is there any danger to how Service Fabric normally operates to registering this service as a Windows Job and limiting its CPU consumption? We have tested it and it appears to work, but we want to make sure this won't have side effects to how Service Fabric operates.


Solution

  • Yup, you can just configure Resource Governance to limit the process to some number of cores. Docs here.

      <ServiceManifestImport>
        <ServiceManifestRef ServiceManifestName='ServicePackageA' ServiceManifestVersion='v1'/>
        <Policies>
          <ServicePackageResourceGovernancePolicy CpuCores="1"/>
          <ResourceGovernancePolicy CodePackageRef="CodeA1" CpuShares="512" MemoryInMB="1000" />
          <ResourceGovernancePolicy CodePackageRef="CodeA2" CpuShares="256" MemoryInMB="1000" />
        </Policies>
      </ServiceManifestImport>