Often, you may want to ensure that all your worker actors are processing roughly the same number of messages. Akka provides a couple of interesting approaches to achieve this behavior. The first one is using a balancing dispatcher. This dispatcher is backed by ExecutorService where a group of actors shares the same mailbox. The dispatcher will try to redistribute work from busy actors to idle actors. This dispatcher can be easily used by implementing BalancingPool, as we will see in this recipe.
The second option is using SmallestMailboxRouter. When sending a message, this type of router would try to route the message to the actor with the mailbox with fewer messages. In this recipe, we will look at how to configure our actors to use either of these approaches.