使用不同的“cpuShares”设置(500和1500)将同一容器应用程序的2个版本部署到Service Fabric。我预计当两个托管在同一主机上时,版本1将被分配三分之一的CPU然后第二个但实际上它们都占用了50%的CPU。 https://msdn.microsoft.com/en-us/library/windows/hardware/dn312121(v=vs.85).aspx#step3
App Manifest
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="PI_CalculatorType" ApplicationTypeVersion="770Shares" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<Parameters>
<Parameter Name="PI_Web_Service_InstanceCount" DefaultValue="-1" />
</Parameters>
<ServiceManifestImport>
<ServiceManifestRef ServiceManifestName="PI_Web_ServicePkg" ServiceManifestVersion="770Shares" />
<ConfigOverrides />
<Policies>
<ContainerHostPolicies CodePackageRef="Code">
<PortBinding ContainerPort="80" EndpointRef="PI_Web_ServiceTypeEndpoint" />
</ContainerHostPolicies>
<ResourceGovernancePolicy CodePackageRef="Code" MemorySwapInMB="4084" MemoryReservationInMB="1024" CpuShares="770" />
</Policies>
</ServiceManifestImport>
<DefaultServices>
<Service Name="PI_Web_Service">
<StatelessService ServiceTypeName="PI_Web_ServiceType" InstanceCount="[PI_Web_Service_InstanceCount]">
<SingletonPartition />
</StatelessService>
</Service>
</DefaultServices>
</ApplicationManifest>
服务清单
<ServiceManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="PI_Web_ServicePkg" Version="770Shares" xmlns="http://schemas.microsoft.com/2011/01/fabric">
<ServiceTypes>
<StatelessServiceType ServiceTypeName="PI_Web_ServiceType" UseImplicitHost="true" />
</ServiceTypes>
<CodePackage Name="Code" Version="770Shares">
<EntryPoint>
<ContainerHost>
<ImageName>artisticcheese/iis:latest</ImageName>
</ContainerHost>
</EntryPoint>
</CodePackage>
<ConfigPackage Name="Config" Version="770Shares" />
<Resources>
<Endpoints>
<Endpoint Name="PI_Web_ServiceTypeEndpoint" Protocol="http" UriScheme="http" />
</Endpoints>
</Resources>
</ServiceManifest>
要调用以重现的网址
http://192.168.1.193:20001/pi/service.svc/pi/40000