I have a use case where a million individual actors will be created across the cluster.
The tasks will be received from outside cluster and i have to identify and send the task to assigned single actor for that task.
How can i create actor from outside of the cluster if i use Cluster sharding and how to send message to that particular actor from outside of the cluster nodes
If i use Cluster sharding i have to create seperate shard for a actor.Which means
Million shards have to created for million actors.
How to identify the shard and actor in cluster?
A shard is just a local grouping of actors that are all hosted in the same process - it's an arbitrary way of grouping entity actors together in Akka.NET. Typically we use consistent hashing (
HashCodeMessageExtractor
) to assign entity actors to a shard based on the entity actor's unique id, which you extract from the content of the messages sent to it via theShardRegion
and theIMessageExtractor
(most commonly, aHashCodeMessageExtractor
).This is a great tool for being able to distribute millions of actors horizontally across a large cluster - I just published a sample the other day where I was running 200 Akka.NET nodes with 2000 total shards (10 per node) with the ability to host 10s of millions of actors: https://github.com/petabridge/AkkaDotNet.LargeNetworkTests - you might find that helpful!