1
votes

I am writing a java/scala akka proof of concept and currently I am fumbling with the actor concept in a cluster environment.

Specification

I have a specific situation where a system sends the same messages to multiple nodes. My job is to not drop any of those messages and pass only 1 message to a backend system. Like a unique filter with load balancing/fail-over capabilities.

Idea

I was thinking of using 2 "frontend" actors on 2 nodes and the system would send messages to a frontend router (lets say round-robin) which sends to the frontend actors that send to the backend.

The other fallback solution would be to use a only-leader-send-to-backend system where they all get the same message and only the leader passes it forward.

Problem

The problem I am facing (see code) is that I want the router to use existing frontend actors as routees on the cluster. This fails in the sample code because the router looks for the routees by routees-path (config setting) only locally, doesn't find any and dies.

I haven't had success with the config where the router deploys routees on the cluster nodes either. It would always deploy them locally.

I have sample code here http://ge.tt/2UHUqoQ/v/0?c. There are 2 entry points * TransformationSample.App2 - run two instances with commandline params 2551 and 2552 each (seed nodes) * TransformationSample.App1 - run one instance with no commandline params

The App1 is the one that tries to create a router and communicate with it but the router terminates because it can't find the frontend routers locally. I have the issue pinned to the akka.cluster.routing.ClusterRouteeProvider class createRoutees method line 178 https://github.com/akka/akka/blob/releasing-2.1.0-RC1/akka-cluster/src/main/scala/akka/cluster/routing/ClusterRouterConfig.scala.

In closing

I am probably doing something wrong here and please excuse my scala (this is the first project I am writing it with).

The reason why I am wishing for this router thingy to work is because the next step of the proof of concept would be to load balance the backend system with a similar setup where the frontend actors would communicate with a (separate) backend cluster router which sends work round-robin to backend actors.

Is this over-engineered? We have to have fail-over for the front part and load balancing on the back part.

1

1 Answers

0
votes

First, what kind of actor are you using? Scala and Akka actors are different from each other. If you are using an akka actor, try using the Remote Actor System which is really good especially if you have DB installed.