Hmm.  What do you mean by "parent / child" here?  There are two usages that
often get conflated but which are actually *very* different in Akka, and
the difference is relevant here.

On the one hand, there is a *logical* relationship: in the semantics of the
application, one kind of thing is the "parent", and it has a bunch of
"children".  This tends to be reflected in the data, and often in the
interactions.

On the other hand, there is the *physical* relationship in Akka -- one
parent Actor being the supervisor / owner of a bunch of child Actors.

It's very common for folks who have the first situation to represent it as
the second, but it's often a mistake: the data doesn't necessarily dictate
the Actor parent/child relationships, and frequently shouldn't.  But
sometimes it is appropriate for them to be parent/child Actors.

Consider it this way: can you reframe the problem as a "one-to-many"
relationship of independent entities, or are they truly parent/child Actors?

To answer your actual question: no, as far as I know sharding is
incompatible with this kind of Actor-level parent/child relationship.  The
parent of a Sharded Entity is the Sharding Region, so you can't just have
the children of a given Actor be "sharded".  You *can*, quite
straightforwardly, have independent Sharded Entities in one-to-many
relationships, but they're not really "parents" and "children" in that
case.  Hence my focus here: do you actually care about the *Actors* being
parent/child, or is it enough for them to simply have a relationship?

On Mon, Jun 5, 2017 at 6:38 AM, Martijn Lindhout <martijn.lindh...@gmail.com
> wrote:

> Hi all,
>
> I have an application with some of the actors having a parent / child
> relationship (mostly the case in Akka :-)), but...
>
> - the parent is a PersistedActor and it is sharded because there may be to
> many for a single machine
> - those parents can have many children also, even those might not fit in a
> single machine.
>
> As I understand sharding: when an actor is sharded, they are distributed
> around the cluster and their children remain with the parents.
>
> In order to prevent OOM, is it sound the shard the children also? I've not
> done this before, so I'm just looking for advice / design patterns, etc
>
> Regards!
>
> --
> >>>>>>>>>> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>

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

Reply via email to