What if I have an actor who needs to have a lot of bandwidth?

I have an actor who collects some information and processes it. Currently, it looks like this:

class MessageTracerActor extends Actor{

  override def receive: Receive = {
      case MyActor.TracableMessage(msg) => //send processed msg to another place
      case v: Any => //corner-case, has special handler
  }
}

The actor must send a trace of messages that expand TracableMessage. But it TracableMessagesleaves from a fairly large number of participants and placement MessageTracerActoron one machine is not entirely good.

I looked at clusterization , but that doesn't seem to be the case. They said

Cluster aggregation is most commonly used when you have many entities in terms of state that together consume more resources (like memory) than are suitable for a single machine. If you only have a few entities working with state, it might be easier to run them on the Cluster Singleton node.

But Cluster Singleton is placed strictly on one node, which does not scale.

Maybe there is some kind of configuration parameter with which I could indicate the number of threads (maybe even nodes) used to process messages received by the actor?

+4
source share
1 answer

.

node

, , routing. - , .

// create a round robin style router for actors
val router: ActorRef = context.actorOf(RoundRobinPool(5).props(Props[MessageTracerActor]), "tracer-router")

-. , , : , , , . , , , .

, , . , , . , , , . , , .

. Akka , . -. , , .

Akka node, , Akka . Akka, , , , node.

. , . , , , node.

, . -, , . , , , , .

, - Akka . . , API Akka 2.4.

, (, , node). , Akka persistence.

+4

Source: https://habr.com/ru/post/1652312/


All Articles