每个节点不止一个无状态服务实例 [英] More than one instance of stateless service per node

查看:161
本文介绍了每个节点不止一个无状态服务实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Config.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)

解决方案

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

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

如果没有足够的可用资源,则按节点进行扩展,即应将其他节点添加到群集,并且在无状态服务的情况下(如果InstanceCount = -1),它将自动创建新实例./p>

My stateless service receives tasks from Service Bus queue and processes it. I'm trying now to find an optimal way to use resources of Service Fabric node as much as possible. So I see 2 approaches: 1) create several threads inside the service 2) create several instances of the service per node. I consider that the 2nd way is more safe and correct but when I specified InstanceCount = 5 for 1-node cluster I received a warning.

Config.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>

Error:

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)

解决方案

As mentioned by @Diego Mendes this isn't possible.

Based on the documentation I would say that Service Fabric expects the instance of service to be able to utilize all available resources and report the appropriate metrics to allow Cluster Manager service to balance the load between nodes in a cluster.

In case when there is not enough available resource the scaling is done in term of nodes i.e. additional nodes should be added to the cluster and in case of stateless service (if InstanceCount=-1) it will automatically create new instances.

这篇关于每个节点不止一个无状态服务实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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