[SERVER-5507] Add sharded per-collection settings (chunksize/balancing/window) Created: 05/Apr/12 Updated: 16/Jan/24 |
|
| Status: | Blocked |
| Project: | Core Server |
| Component/s: | Sharding |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Scott Hernandez (Inactive) | Assignee: | Backlog - Catalog and Routing |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | balancer, chunks, sharding | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Assigned Teams: |
Catalog and Routing
|
||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||||||
| Description |
|
Not every collection needs to be balanced in the same ways. The maxChunkSize for example will depend on the avg doc size in many cases. |
| Comments |
| Comment by Tommaso Tocci [ 04/Nov/21 ] |
|
|
| Comment by Esha Maharishi (Inactive) [ 02/Mar/20 ] |
Current state of the worldGlobal settingsThe following auto-balancing settings are global (not per namespace), and are stored in three documents in the config.settings collection on the config server:
Every cluster node has an in-memory cache of these settings in an instance of BalancerConfiguration, which lives on the Grid. Mongos periodically refreshes its BalancerConfiguration under the ShardingUptimeReporter thread, which is launched on mongos startup. I actually am not sure why mongos needs to know the BalancerConfiguration - kaloian.manassiev, renctan, is it unnecessary now that neither autosplitting nor autobalancing are done by mongos? Shard primaries periodically refresh their BalancerConfiguration under the PeriodicBalancerConfigRefresher thread, which is launched on sharding initialization, paused on stepdown, and resumed on stepup. On shards, the ShardServerOpObserver calls incrementChunkOnInsertOrUpdate, which checks whether to initiate a split attempt. Config servers periodically refresh their BalancerConfiguration under the balancer thread. On config servers, the balancer thread checks whether to do a balancing round and whether to balance jumbo chunks. Per-collection settingsAdditionally, there is a per-collection setting for whether to allow auto-balancing, which is stored in each entry in config.collections. Shards check this setting to determine whether to opt out of auto-splitting for a specific collection. Config servers check this setting to determine whether to opt out of auto-balancing for a specific collection. |