Modify Chunk Size in a Sharded Cluster
The default chunk size for a sharded cluster is 64 megabytes. Thisdefault chunk size works well for most deployments; however, if younotice that automatic migrations have more I/O than your hardware canhandle, you may want to reduce the chunk size. For automatic splits andmigrations, a small chunk size leads to more rapid and frequentmigrations. The allowed range of the chunk size is between 1 and 1024megabytes, inclusive.
To modify the chunk size, use the following procedure:
Issue the following command to switch to the Config Database:
- use config
- Issue the following
save()
operation tostore the global chunk size configuration value:
- db.settings.save( { _id:"chunksize", value: <sizeInMB> } )
Modifying the chunk size has several limitations:
- Automatic splitting only occurs on insert or update.
- If you lower the chunk size, it may take time for all chunks to split tothe new size.
- Splits cannot be undone.
- If you increase the chunk size, existing chunks grow only throughinsertion or updates until they reach the new size.
- The allowed range of the chunk size is between 1 and 1024 megabytes,inclusive.