Skip to main content

How does MongoDB’s balancer decide when to migrate chunks?

Senior MongoDB
Quick Answer The balancer triggers migration when the chunk count difference between the most and least loaded shards exceeds a threshold (varies by total chunk count). It migrates chunks from the most loaded to least loaded shards until balanced. Balancing uses collection-level locks during certain migration phases. Schedule balancing windows (balancerStart/Stop) to avoid peak traffic hours.

Answer

The balancer monitors shard chunk distribution via config servers and migrates chunks when imbalance thresholds are exceeded.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice