Let's imagine a typical Akka application with a tree like structure of Actors i.e. a small (2-3) number of top level actors which manage potentially thousands of small actors at the bottom of the hierarchy. It seems there are two approaches to persistence:
- Make only the top level actors persistent. The child actors rely on their parents for any state recovery etc.
- Make all of the children actors persistent. We end up with potentially thousands of persistence ids and each actor can recover it's own state.
What considerations are there when choosing between these approaches? Are there any typical examples of use cases that fit well with one but not the other?
The question is supposed to be abstract but here's an example. Say we have an actor for every user of the application, and these actors share the same parent actor. If we want to persist each user's email address and any updates to it, we could make every user actor persistent or we could just make the top level actor persistent.