Akka Cluster

If you have a set of actor systems that cooperate to solve some business problem, then you likely want to manage these set of systems in a disciplined way. Akka Cluster gives you the ability to organize these actor systems into a “meta-system” tied together by a membership protocol.

Challenges the Cluster module solves include the following:

  • How to maintain a set of actor systems (a cluster) that can communicate with each other and consider each other as part of the cluster.

  • How to introduce a new system safely to the set of already existing members.

  • How to reliably detect systems that are temporarily unreachable.

  • How to remove failed hosts/systems (or scale down the system) so that all remaining members agree on the remaining subset of the cluster.

  • How to distribute computations among the current set of members.

  • How to designate members of the cluster to a certain role, in other words, to provide certain services and not others.


Sharding helps to solve the problem of distributing a set of actors among members of an Akka cluster. Sharding is a pattern that mostly used together with Persistence to balance a large set of persistent entities (backed by actors) to members of a cluster and also migrate them to other nodes when members crash or leave.

Challenges that Sharding solves include the following:

  • How to model and scale out a large set of stateful entities on a set of systems.

  • How to ensure that entities in the cluster are distributed properly so that load is properly balanced across the machines.

  • How to ensure migrating entities from a crashed system without losing the state.

  • How to ensure that an entity does not exist on multiple systems at the same time and hence keeps consistent.

The Event Sourced Cart entity in the Microservices tutorial illustrates how to use Akka Cluster Sharding to manage the entities. It is also using Sharding for distributing the Projections.

Split Brain Resolver

When operating an Akka cluster you must consider how to handle network partitions (a.k.a. split brain scenarios) and machine crashes (including JVM and hardware failures). This is crucial for correct behavior if you use Cluster Singleton or Cluster Sharding, especially together with Akka Persistence.

Learn more