diff --git a/akka-cluster-sharding/src/main/resources/reference.conf b/akka-cluster-sharding/src/main/resources/reference.conf index 8f0478b50c..e9cf8fbaf8 100644 --- a/akka-cluster-sharding/src/main/resources/reference.conf +++ b/akka-cluster-sharding/src/main/resources/reference.conf @@ -99,6 +99,7 @@ akka.cluster.sharding { # The difference between number of shards in the region with most shards and # the region with least shards must be greater than (>) the `rebalanceThreshold` # for the rebalance to occur. + # It is also the maximum number of shards that will start rebalancing per rebalance-interval # 1 gives the best distribution and therefore typically the best choice. # Increasing the threshold can result in quicker rebalance but has the # drawback of increased difference between number of shards (and therefore load) diff --git a/akka-cluster-sharding/src/main/scala/akka/cluster/sharding/ShardCoordinator.scala b/akka-cluster-sharding/src/main/scala/akka/cluster/sharding/ShardCoordinator.scala index 5fa2a619ed..bc318aa08c 100644 --- a/akka-cluster-sharding/src/main/scala/akka/cluster/sharding/ShardCoordinator.scala +++ b/akka-cluster-sharding/src/main/scala/akka/cluster/sharding/ShardCoordinator.scala @@ -866,7 +866,13 @@ abstract class ShardCoordinator( } } - def continueRebalance(shards: Set[ShardId]): Unit = + def continueRebalance(shards: Set[ShardId]): Unit = { + if (log.isInfoEnabled && (shards.nonEmpty || rebalanceInProgress.nonEmpty)) { + log.info( + "Starting rebalance for shards [{}]. Current shards rebalancing: [{}]", + shards.mkString(","), + rebalanceInProgress.keySet.mkString(",")) + } shards.foreach { shard => if (!rebalanceInProgress.contains(shard)) { state.shards.get(shard) match { @@ -885,6 +891,7 @@ abstract class ShardCoordinator( } } + } }