hveiga
hveiga

Reputation: 6915

Akka Cluster, Cluster Sharding and Cluster singleton use cases

I am writing an Akka application and I want to use the Akka Cluster feature that Typsafe provides. I am trying to understand the main difference between Akka Cluster, Akka Cluster Singleton and Akka Cluster Sharding. To me, they seem to be providing similar things.

In my scenario I want to have a cluster that will have:

Based on what I have read I would need Akka Cluster for the first kind, Akka Cluster Singleton for the second kind and Akka Cluster Sharding for the third kind. Is my assumption correct? I am looking for some guidance as well as any example online if you know any.

Upvotes: 2

Views: 2899

Answers (2)

Will Sargent
Will Sargent

Reputation: 4396

"Stateless actors that could live in any machine" -- this sounds like akka cluster.

"Stateless actors that I want them to live in specific machines" -- this sounds like akka cluster singleton, but you can also use roles

"being able to restart the actor with its previous state if it dies" -- this sounds like Akka Cluster Sharding with akka-persistence.

Upvotes: 3

dnvriend
dnvriend

Reputation: 31

Take a look at https://github.com/dnvriend/spray-ba-sharding and https://github.com/dnvriend/spray-ba-singleton for some use case. The akka documentation is actually pretty good. Also look at the activator templates.

Upvotes: 3

Related Questions