General Question about organization

55 views
Skip to first unread message

Bill Donn

unread,
Nov 27, 2015, 6:07:23 AM11/27/15
to Akka User List
I have a rather general question about best practices with akka.

I'd like to create an application with multiple components.  For example, I'd like to stream input data with akka.io to add to a database;  I'd also like perhaps a web page to expose the data, or perhaps a rest interface to expose the data.  And perhaps some internal data crunching.    

The actual components aren't really important, instead I was wondering if anyone might share some thoughts on how best to integrate multiple services like this;  is it best to run each as a separate process, or to use a master actor to initiate each of the processes, so as to control restart in the event of failure?  Appreciate any insight.

Richard Rodseth

unread,
Nov 28, 2015, 12:47:14 PM11/28/15
to akka...@googlegroups.com
One thing you can look into is using the EventBus to send "domain events" between top-level actors. Apparently top-level actors (i.e. created with system.actorOf rather than context.actorOf) are more expensive so you don't want zillions of them, but I think a handful of loosely-coupled components is fine.

--
>>>>>>>>>> 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 akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Heiko Seeberger

unread,
Nov 28, 2015, 4:03:25 PM11/28/15
to akka...@googlegroups.com
On 28 Nov 2015, at 18:47, Richard Rodseth <rrod...@gmail.com> wrote:

One thing you can look into is using the EventBus to send "domain events" between top-level actors. Apparently top-level actors (i.e. created with system.actorOf rather than context.actorOf) are more expensive

Really? Could you elaborate?

Thanks
Heiko

Richard Rodseth

unread,
Nov 28, 2015, 7:55:24 PM11/28/15
to akka...@googlegroups.com
Oh, sorry, I thought I remembered reading that in the docs, but perhaps it was just the cost of an actor system vs an actor.
Hopefully my advice was OK regardless :)

Heiko Seeberger

unread,
Nov 29, 2015, 2:18:45 AM11/29/15
to akka...@googlegroups.com
On 29 Nov 2015, at 01:55, Richard Rodseth <rrod...@gmail.com> wrote:

Oh, sorry, I thought I remembered reading that in the docs, but perhaps it was just the cost of an actor system vs an actor.

Ah, yes.

Hopefully my advice was OK regardless :)

I agree with you. Although I go for a single top-level actor per JVM for the following two reasons:
(1) Akka Typed (aka Akka 3?) has no actorOf, but instead you create an ActorSystem by passing Props for the single top-level actor
(2) Typically the actors created by the single top-level actor are super important for the system to work properly and therefore the top-level actor needs a custom supervisor strategy – something you can only achieve with a configured SupervisorStrategyFactory for the guardian otherwise

Heiko
signature.asc
Reply all
Reply to author
Forward
0 new messages