Round Robin Group over two different hosts is not working

195 Views Asked by At

I am trying to split load over more than one akka actor system. Unfortunately the round robin group in not forwarding messages to remote workers. I can see that actor is activated, but there is no work done.

the full code is on github

Is there any other setting that I could miss in my configuration?

 private void CreateRemoteCrawlerGroup()
        {
            var hostname = "374110044f24";
            var hostname2 = "25b360699a27";

            var remoteAddress2 = Address.Parse($"akka.tcp://DeployTarget@{hostname2}:8090");
            var remoteScope2 = new RemoteScope(remoteAddress2);
            var remoteCrawler1 =
                Context.ActorOf(
            Props.Create(() => new WebCrawlerActor(new AppSettingsConfiguration(), Self))
            .WithRouter(new RoundRobinPool(2)) // new DefaultResizer(1, 2, messagesPerResize: 500)
                             .WithDispatcher("my-dispatcher")
            .WithDeploy(Deploy.None.WithScope(remoteScope2)), "a");

            var remoteAddress = Address.Parse($"akka.tcp://DeployTarget@{hostname}:8090");

            var remoteScope = new RemoteScope(remoteAddress);
            var remoteCrawler2 =
                Context.ActorOf(
            Props.Create(() => new WebCrawlerActor(new AppSettingsConfiguration(), Self))
            .WithRouter(new RoundRobinPool(2)) // new DefaultResizer(1, 2, messagesPerResize: 500)
                             .WithDispatcher("my-dispatcher")
            .WithDeploy(Deploy.None.WithScope(remoteScope)), "remoteCrawler01");

            var workers = new List<string> { remoteCrawler1.Path.ToString(), remoteCrawler2.Path.ToString() };
            var router = Context.ActorOf(Props.Empty.WithRouter(new RoundRobinGroup(workers)), "some-group");
            _actorDictionary.Add("WebCrawlerActor", router);
        }
1

There are 1 best solutions below

0
On

the solution was switch to akka cluster and use clustr pool instead

  var remoteEcho2 =
                Context.ActorOf(
                    Props.Create(() => new WebCrawlerActor(new AppSettingsConfiguration(), Self))
                        .WithRouter(new ClusterRouterPool(new RoundRobinPool(5), new ClusterRouterPoolSettings(5, 1, true, "crawler"))), "WebCrawlerActor2a");

            _actorDictionary.Add("WebCrawlerActor", remoteEcho2);