Skip to content

Commit

Permalink
DOCS-7145: limits for sharding existing data
Browse files Browse the repository at this point in the history
Signed-off-by: kay <kay.kim@10gen.com>
  • Loading branch information
ravindk89 authored and kay-kim committed Jun 13, 2016
1 parent 7efebd5 commit 7b6fda5
Showing 1 changed file with 60 additions and 28 deletions.
88 changes: 60 additions & 28 deletions source/reference/limits.txt
Expand Up @@ -322,42 +322,74 @@ Sharding Operational Restrictions

.. limit:: Sharding Existing Collection Data Size

For existing collections that hold documents, MongoDB supports
enabling sharding on *any* collections that contains less than 256
gigabytes of data. MongoDB *may* be able to shard collections with as
many as 400 gigabytes depending on the distribution of document
sizes. The precise size of the limitation is a function of the
chunk size and the data size. Consider the following table:
An existing collection can only be sharded if its size does not exceed
specific limits. These limits can be estimated based on the average size of
all :term:`shard key` values, and the configured :term:`chunk` size.

.. important::

These limits only apply for the initial sharding operation. Sharded
collections can grow to *any* size after successfully enabling sharding.

Use the following formulas to calculate the *theoretical* maximum
collection size.

.. code-block:: javascript

maxSplits = 16777216 (bytes) / <average size of shard key values in bytes>
maxCollectionSize (MB) = maxSplits * (chunkSize / 2)

.. note::

The maximum :term:`BSON` document size is 16MB or ``16777216`` bytes.

All conversions should use base-2 scale, e.g. 1024 kilobytes = 1
megabyte.

If ``maxCollectionSize`` is less than or nearly equal to the target
collection, increase the chunk size to ensure sucessful initial sharding.
If there is doubt as to whether the result of the calculation is too
'close' to the target collection size, it is likely better to increase the
chunk size.

After successful initial sharding, you can reduce the chunk size as needed.
If you later reduce the chunk size, it may take time for all chunks to
split to the new size. See
:doc:`/tutorial/modify-chunk-size-in-sharded-cluster` for instructions on
modifying chunk size.

This table illustrates the approximate maximum collection sizes
using the formulas described above:

.. list-table::
:header-rows: 1
:stub-columns: 1

* - Shard Key Size
* - Average Size of Shard Key Values
- 512 bytes
- 200 bytes
* - Number of Splits
- 31,558
- 85,196
* - Max Collection Size (1 MB Chunk Size)
- 31 GB
- 83 GB
- 256 bytes
- 128 bytes
- 64 bytes
* - Maximum Number of Splits
- 32,768
- 65,536
- 131,072
- 262,144
* - Max Collection Size (64 MB Chunk Size)
- 1.9 TB
- 5.3 TB
- 1 TB
- 2 TB
- 4 TB
- 8 TB
* - Max Collection Size (128 MB Chunk Size)
- 2 TB
- 4 TB
- 8 TB
- 16 TB
* - Max Collection Size (256 MB Chunk Size)
- 7.6 TB
- 21.2 TB
* - Max Collection Size (512 MB Chunk Size)
- 15.2 TB
- 42.4 TB

The data in this chart reflects documents with no
data other than the shard key values and therefore represents the
smallest possible data size that could reach this limit.

.. important:: Sharded collections may have *any* size, after
successfully enabling sharding.
- 4 TB
- 8 TB
- 16 TB
- 32 TB

.. limit:: Single Document Modification Operations in Sharded Collections

Expand Down

0 comments on commit 7b6fda5

Please sign in to comment.