简体   繁体   English

Akka.NET:将akka.net群集中子角色的创建限制为一台机器

[英]Akka.NET: Restrict child actor creation in akka.net cluster to a single machine

We have a particular scenario in our application - All the child actors in this application deals with huge volume of data (Around 50 - 200 MB). 我们的应用程序中有一个特殊的场景-该应用程序中的所有子参与者都处理大量数据(大约50-200 MB)。 Due to this, we have decided to create the child actors in the same machine (worker process) in which parent actor was created. 因此,我们决定在创建父actor的同一台计算机(工作进程)中创建子actor。

Currently, this is achieved by the use of Roles. 当前,这是通过使用角色来实现的。 We also use .NET memory cache to transfer the data (Several MBs) between child actors. 我们还使用.NET内存缓存在子参与者之间传输数据(几个MB)。

Question : Is it ok to turn off clustering in the child actors to achieve the result we are expecting? 问题 :是否可以关闭子actor中的群集以达到我们期望的结果?

Edit : To be more specific, I have explained the our application setup in detail, below. 编辑 :更具体地说,我在下面详细说明了我们的应用程序设置。

  • The whole process happens inside a Akka.NET cluster of around 5 machines 整个过程发生在由5台机器组成的Akka.NET集群内
  • Worker processes (which contains both parent and child actors) are deployed in each of those machines 在每台机器中都部署了工作进程(包含父和子参与者)
  • Both parent and child actors are cluster enabled, in this setup 在此设置中,父级和子级参与者都启用了群集

When we found out the network overhead caused by distributing the child actors across machines, we decided to restrict child actor creation to the corresponding machines which received the primary request, and distribute only the parent actor across machines. 当我们发现由在各个计算机之间分布子actor导致的网络开销时,我们决定将子actor的创建限制为接收到主要请求的相应计算机,而仅在各个计算机之间分配父actor。

While approaching an Akka.NET expert with this problem, we were advised to use "Roles" in order to restrict the child actor creation to a single machine in a cluster system. 当与Akka.NET专家联系时,建议我们使用“角色”,以将子角色的创建限制在群集系统中的单个计算机上。 (Eg, Worker1Child, Worker2Child instead of "Child" role) (例如,Worker1Child,Worker2Child而不是“ Child”角色)

Question (Contd.) : I just want to know, if simply by disabling cluster option in child actors will achieve the same result; 问题(续) :我只是想知道,如果仅通过在子actor中禁用集群选项就能达到相同的结果; and is it a best practice to do so? 这是最佳做法吗?

Please advise. 请指教。

Sounds to me like you've been using a clustered pool router to remotely deploy worker actors across the cluster - you didn't explicitly mention this in your description, but that's what it sounds like. 在我看来,您一直在使用集群池路由器在集群中远程部署工作人员-您在描述中没有明确提及,但这听起来很像。

It also sounds like, what you're really trying to do here is take advantage of local affinity: have child worker actors for the same entities all work together inside the same process. 听起来,您在这里真正想做的就是利用本地亲缘关系:让同一实体的童工演员在同一流程中一起工作。

Here's what I would recommend: 这是我的建议:

  1. Have all worker actors created as children of parents, locally, inside the same process, but either using something like the child-per-entity pattern or a LOCAL pool router. 在相同的过程中,在本地创建所有工人角色作为父母的孩子,但使用诸如“ 每个实体孩子”模式或LOCAL池路由器之类的东西。
  2. Distribute work between the worker nodes using a clustered group router, using roles etc. 使用群集组路由器,使用角色等在工作节点之间分配工作。
  3. Any of the work in that high volume workload should all flow directly from parent to children, without needing to round-trip back and forth between the rest of the cluster. 大量工作量中的任何工作都应直接从父级流向子级,而无需在集群的其余部分之间来回往返。

Given the information that you've provided here, this is as close to a "general" answer as I can provide - hope you find it helpful! 鉴于您在此处提供的信息,这与我所能提供的“一般”答案非常接近-希望对您有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM