@@ -263,12 +263,12 @@ Shard Key Indexes
263263
264264All sharded collections **must** have an index that starts with the
265265:term:`shard key`. If you shard a collection that does not yet contain
266- documents and *without* such an index, the :dbcommand:`shardCollection`
266+ documents and *without* such an index, the :dbcommand:`shardCollection`
267267will create an index on the shard key. If the collection already
268268contains documents, you must create an appropriate index before using
269269:dbcommand:`shardCollection`.
270270
271- .. TODO replace the link
271+ .. TODO replace the link
272272
273273.. versionchanged:: 2.2
274274 The index on the shard key no longer needs to be identical to the
@@ -304,7 +304,7 @@ and you want to replace this with an index on the field ``{ zipcode:
304304
305305 If you drop the last appropriate index for the shard key, recover
306306 by recreating a index on just the shard key.
307-
307+
308308.. index:: balancing; internals
309309.. _sharding-balancing-internals:
310310
@@ -333,8 +333,8 @@ chunks in a collection is unevenly distributed among the shards, the
333333balancer begins migrating :term:`chunks <chunk>` from shards with more
334334chunks to shards with a fewer number of chunks. The balancer will
335335continue migrating chunks, one at a time, until the data is evenly
336- distributed among the shards (i.e. the difference between any two
337- shards is less than 2 chunks.)
336+ distributed among the shards. See the :ref:`migration thresholds
337+ <sharding-migration-thresholds>` section for more information.
338338
339339While these automatic chunk migrations are crucial for distributing
340340data, they carry some overhead in terms of bandwidth and workload,
@@ -353,6 +353,36 @@ sends all new writes, to the "receiving" server. Finally,
353353:program:`mongos` updates the chunk record in the :term:`config
354354database` to reflect the new location of the chunk.
355355
356+ .. _sharding-migration-thresholds:
357+
358+ Migration Thresholds
359+ ~~~~~~~~~~~~~~~~~~~~
360+
361+ .. versionchanged:: 2.2
362+ The following thresholds appear first in 2.2; prior to this
363+ release, balancing would only commence if the shard with the most
364+ chunks had 8 more chunks than the shard with the least number of
365+ chunks.
366+
367+ In order to minimize the impact of balancing on the cluster, the
368+ :term:`balancer` will not begin balancing until the distribution of
369+ chunks has reached certain thresholds. These thresholds apply to the
370+ difference in number of :term:`chunks <chunk>` between the shard with
371+ the greatest number of chunks and the shard with the least number of
372+ chunks. The balancer has the following thresholds:
373+
374+ ================ ===================
375+ Number of Chunks Migration Threshold
376+ ---------------- -------------------
377+ Greater than 80 8
378+ 80-21 4
379+ Less than 20 2
380+ ================ ===================
381+
382+ Once a balancing round starts, the balancer will not stop until the
383+ difference between the number of chunks on any two shards is *less
384+ than two.*
385+
356386.. index:: sharding; chunk size
357387.. _sharding-chunk-size:
358388
0 commit comments