In a MongoDB sharded cluster, the balancer thread runs on the config server primary and is responsible for performing chunk migrations to ensure an even distribution of data across shards. The goal is to have each shard own approximately the same amount of data for a given sharded collection.
Prior to MongoDB 6.1, the balancer focused solely on distributing chunks, not the actual data size. This meant that if chunks were unevenly sized, the cluster could appear balanced in terms of chunk count, while the underlying data distribution remained skewed.
Starting with MongoDB 6.1 (and backported to 6.0.3 with the Feature Compatibility Version (FCV) set to "6.0"), the balancer now distributes data based on data size rather than the number of chunks. This change coincides with the removal of the chunk auto-splitter, leading to more accurate and efficient data distribution across shards in sharded clusters.