[SERVER-78546] Improve primary shard selection Created: 29/Jun/23  Updated: 26/Oct/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Renato Riccio Assignee: Backlog - Catalog and Routing
Resolution: Unresolved Votes: 0
Labels: oldshardingemea, shardingemea-qw
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Catalog and Routing
Participants:
Story Points: 1

 Description   

Currently the engine will select as primary shard for a new db the most empty shard (code).

 

For an empty cluster usually the dbs are created all together and therefore all dbs will be located on the same shard.
The selection algorithm could be improved in order to distribute the primary shards even when the cluster is empty, something like:

  • take the smallest shard
  • take all the shards in the smallest + threashold (e.g. 50GB)
  • from them chose the one with lowest number of collections
  • if all the same chose one random

Generated at Thu Feb 08 06:38:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.