【问题标题】:More than one instance of stateless service per node每个节点有多个无状态服务实例
【发布时间】:2018-10-25 05:22:25
【问题描述】:

我的无状态服务从服务总线队列接收任务并对其进行处理。我现在正在尝试找到一种尽可能多地使用 Service Fabric 节点资源的最佳方式。所以我看到了 2 种方法:1)在服务中创建多个线程 2)为每个节点创建多个服务实例。我认为第二种方式更安全、更正确,但是当我为 1 节点集群指定 InstanceCount = 5 时,我收到了警告。

配置.xml

<?xml version="1.0" encoding="utf-8"?>
<Application xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Name="fabric:/EmailSenderApp" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <Parameters>
    <Parameter Name="MainService_InstanceCount" Value="1" />
    ...
  </Parameters>
</Application>

错误:

Unhealthy event: SourceId='System.FM', Property='State', HealthState='Warning', ConsiderWarningAsError=false.
Partition is below target replica or instance count.
fabric:/EmailSenderApp/EmailSenderMainService 5 1 09916a6b-1701-46ce-a281-0e223a68f980
Ready _Node_0 131708550454646056
(Showing 1 out of 1 instances. Total available instances: 1)

【问题讨论】:

    标签: azure-service-fabric service-fabric-stateless


    【解决方案1】:

    目前不可能在同一个节点上拥有多个主分区。

    SF 有放置限制来阻止这个,我的看法是这是一个错误,b 因为没有关于在无状态服务上丢失状态的问题,为此我向Allow singleton stateless services to have multiple instances per node bypassing placement constraint开了一个GitHub问题@

    为了对这个问题进行排序,我通过解决类似问题的选项引导您找到这个答案:

    Simulate 10,000 Azure IoT Hub Device connections from Azure Service Fabric cluster

    【讨论】:

      【解决方案2】:

      正如@Diego Mendes 所述,这是不可能的。

      根据文档,我会说 Service Fabric 期望服务实例能够利用所有可用资源并报告适当的指标,以允许集群管理器服务平衡集群中节点之间的负载。

      如果没有足够的可用资源,则根据节点进行扩展,即应将额外的节点添加到集群中,如果是无状态服务(如果 InstanceCount=-1),它将自动创建新实例。

      【讨论】:

        猜你喜欢
        • 2018-09-18
        • 2020-02-19
        • 2016-10-12
        • 1970-01-01
        • 2019-05-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-11-28
        相关资源
        最近更新 更多