服务结构集实例计数-1 [英] Service Fabric set instance count -1

查看:76
本文介绍了服务结构集实例计数-1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到网络实例计数设置为-1. -1是什么意思?

I see the web instance count is set to -1. What does -1 mean?

<Parameter Name="Web1_InstanceCount" Value="-1" />

推荐答案

在您的示例中,-1只是一个参数值,在上下文中它什么都没有.用您的变量名,它是可能在ApplicationManifest.xml上的服务声明中使用的参数.

In you example, -1 means just a parameter value, out of context it does not mean anything. By the name of your variable, it is a parameter likely to be used on service declaration on your ApplicationManifest.xml.

您可能会遇到类似这样的情况:

You will probably have something like this:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest ApplicationTypeName="MyAppTypeName" ApplicationTypeVersion="1.0.0" xmlns=...>
  <Parameters>
    <Parameter Name="Web1_InstanceCount" Value="-1" />
    <Parameter Name="FEPlacementConstraints" Value="NodeTypeName==FrontEnd" />
  </Parameters>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServicePkg" ServiceManifestVersion="1.0.0" />
    <ConfigOverrides />
  </ServiceManifestImport>
  <DefaultServices>
    <Service Name="Web1">
      <StatelessService ServiceTypeName="MyServiceType" InstanceCount="[Web1_InstanceCount]">
        <SingletonPartition />
        <PlacementConstraints>[FEPlacementConstraints]</PlacementConstraints>
      </StatelessService>
    </Service>
  </DefaultServices>
</ApplicationManifest>

如果要注意,请在开始时定义参数,并在声明服务时在底部使用[]括起来.

If you pay attention, at the beggining your define the parameters, and at the bottom you use them enclosed by [ ] when declaring the services.

现在,关于值-1的含义.

Now, regarding the meaning of the value -1.

-1是一个动态实例计数,这意味着命名服务(Web1)的实例数将随着 个有效节点的数量而动态扩展 .这里要注意可用的有效节点"而不是所有节点"

-1 is a dynamic instance count, that means that the number of instances of your named service(Web1) will scale dynamically with the number of valid nodes available. Pay attention here to 'valid nodes available' not 'all nodes'

为什么有有效的节点可用?

  • 我们假设您有2种节点类型,即FrontEnd&后端.如果您向服务中添加了放置约束以仅在FrontEnd上运行(如示例中所示),则您的服务将在类型为"FrontEnd"的所有节点上运行.
  • 另一点是,每当可用的有效节点数(符合您的服务规则)时,实例数就会更改,例如,您按节点类型比例集来按比例放大/缩小节点数.某些节点发生故障,或者某些规则发生了变化,例如,您基于节点标签创建了一条规则,而这些标签也发生了变化.

您可以找到更多信息此处

这篇关于服务结构集实例计数-1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆