I'm not sure what you mean by hardcoding and automatic actor creation.

As Viktor pointed out, it fyou want a router, that will create actors for you, 
then you need to create a router, like the example here 
http://doc.akka.io/docs/akka/snapshot/scala/routing.html#Pool

It shows you both configuration based and programmatic router creation.

B/

On 28 January 2015 at 16:04:54, Cosmin Marginean ([email protected]) wrote:

Thanks, I believe that's pretty clear.
What is confusing though is this in the context of round robin pools, which the 
documentation is not entirely clear about: 
http://doc.akka.io/docs/akka/snapshot/scala/routing.html

I can't seem to find a reference to a best practice that doesn't involve 
hardcoding /myactor1, /myactor2 etc, but that would allow automatic actor 
creation (if required) using a round robin pool (or other parallelisation 
mechanism).

Cos

On Wednesday, 28 January 2015 14:25:01 UTC, Björn Antonsson wrote:
Hi Cos,

Your single actor will process one single message at a time, in sequence. That 
is a fundamental principle of actors.

If you want to have things happening in parallel then you need to have mutliple 
actors.

B/

On 28 January 2015 at 15:21:14, Cosmin Marginean ([email protected]) wrote:

We're running Akka 2.3.7 (Java) and I'm now working on reconfiguring to scale 
for more throughput (as it apparently isn't happening).

I am struggling with the Akka documentation as well as some of the examples out 
there as there is always some contextual information that seems to be missing.
However, in order to make sure I'm not going mad, I've extracted the code and 
config in a dead-simple unit test (I even removed akka's JavaTestKit).

The code and config here suggest that there should be a lot of messages 
processed in parallel, however the entire processing is totally serialised and 
I can't understand where have I failed in this setup.

Any suggestion would be helpful.

Thank you
Cos

@Test
public void testAkka() throws Exception {
    Config cfg = ConfigFactory.load("test-akka.conf");
    ActorSystem actorSystem = ActorSystem.create("main", cfg.getConfig("main"));
    ActorRef actorRef = actorSystem.actorOf(Props.create(MyActor.class), 
"myactor");
    for (int i = 0; i < 150; i++) {
        actorRef.tell("nothing", ActorRef.noSender());
    }
    Thread.sleep(1000000);
}

public static final class MyActor extends UntypedActor {
    @Override
    public void onReceive(Object message) throws Exception {
        System.out.println("Doing stuff");
        Thread.sleep(2000);
    }


} 


And the test-akka.conf file

main {
  app-dispatcher {
    type = Dispatcher
    executor = "fork-join-executor"
    fork-join-executor {
      parallelism-min = 16
      parallelism-factor = 32.0
      parallelism-max = 512
    }
    throughput = 1
  }

  akka.actor.deployment {
    /myactor {
      dispatcher = app-dispatcher
      router = round-robin-pool
      nr-of-instances = 16
    }
  }
}
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

-- 
Björn Antonsson
Typesafe – Reactive Apps on the JVM
twitter: @bantonsson

--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

-- 
Björn Antonsson
Typesafe – Reactive Apps on the JVM
twitter: @bantonsson

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to