Skip to content

planClusters

planClusters(options): ClusterPlan

Defined in: packages/sharding/src/context.ts:123

Decides which cluster runs which shard, without starting anything:

  • clusterCount: every shard, split in contiguous blocks over that many clusters;
  • shardsPerCluster: ceil(shards / shardsPerCluster) clusters of that size, the last one partial;
  • neither: defaultClusterCount clusters.

There are never more clusters than shards: a larger count is capped (an empty cluster would hold a process for nothing). Every shard is in exactly one cluster.

ClusterPlanOptions

ClusterPlan

For both options at once, or a count that is not a positive integer.