Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flat actor tree

Tags:

scala

akka

actor

Can there be such a thing as too many child actors? For example, if I had an actor with 10000 child actors, would that affect overall performance compared to 10 actors with 1000 child actors each?

-= Why I'm asking =-
I have a problem where an actor has to be spawned at one point of time and tried to be accessed to later. There might be thousands of such actors waiting. Once later accessed, an actor should perform a computationally heavy task and then die. These actors don't need to talk to parent at any point of their life (except that parent should react appropriately to childs' possible failures).

I don't have experience in working with actors and it just seems very easy to have them all with one parent so I can access any child by substituting it's name in path without making (actor_id => path) lookup maps or anything. I'm concerned whether this design decision alone can slow down single parent actor or make it more fragile somehow?

like image 261
src091 Avatar asked Nov 10 '22 11:11

src091


1 Answers

The question is "Performance of what"?

Let's transpose the question onto real life:

Can there be such a thing as too many children? For example, if I had a friend with 10000 children, would that affect overall performance compared to 10 friends with 1000 children each?

"Clearly" the tradeoff is that the more children you have, the less time you have for each of them, and, if you die, more of them will be orphaned.

like image 154
Viktor Klang Avatar answered Nov 14 '22 21:11

Viktor Klang