How many shards do I need?

Hi folks,

I’m having the following scenario, one aggregate root, persistent and sharded, across a cluster of three nodes and following Akka recommendation, 30 shards (10 per node)
At the moment, the total number of this aggregate is over 80K, but since we use passivation of 2 hours, the average of actors live on the cluster is ~15K.
So, in that case, if we have 10 shards per node and 15k entities we end up with 15k actors per node and 500 per shard.

The question here is, is there any rule or best practice for me to determine how many entities per shard should be allocated or how many nodes do I need here?

1 Like

You need at least as many shards as nodes. With the 10x recommendstion you have possibility to scale out to more nodes when needed.

Number of entities (active or passivated) doesn’t matter. Instead, look at memory and cpu usage for each node. If too much, add more nodes.

1 Like