MongoDB Limit and threshold value

Source: Internet
Author: User
Tags memory usage mongodb mongodb limit

The following is a limitation on hardware and software for a single collection of MongoDB.

Bson Document

The maximum of a single Bson document is 16M. The limitation is to ensure that a single document does not consume too much RAM and does not consume too much bandwidth during network transport. MongoDB provides GRIDFS to hold documents that exceed the limit. Specific reference to Mongofiles.

The deepest embedded depth of the Bson document is 100.

Namespaces (namespaces)

The length of each namespace must be less than 123 bytes.

The number of namespaces is the namespace file size (bytes)/628. A 16M namespace file can hold approximately 24,000 namespaces. Each collection and index is a namespace

The namespace file size must be less than 2047M and the default is 16M, and you can use the Nssize property configuration.

Index

Index key restrictions

Index entries cannot be larger than 1024bytes in size.

Other restrictions on indexes for version 2.6

If an index entry for an existing document exceeds the index key limit, MongoDB does not create an index on a collection. Previous versions will create indexes, but you cannot retrieve some documents.

If the index entry for the indexed field exceeds the index key limit, rebuilding the index will be an error. The compact and RepairDatabase commands, as well as the Db.collection.reIndex () method, will rebuild the index. Because these operations will remove all indexes from the collection, and then re-create them sequentially, an error in the index key limit will prevent these operations from rebuilding any remaining indexes that need to be created; however, the repairdatabase command ignores these errors and continues to perform operations other than creating indexes.

If MongoDB attempts to insert data into a collection that has exceeded the index key, the error occurs. Previous versions will still be inserted successfully but will not be retrieved by the index.

Modifies a field that has already been indexed and complains if the modified value causes the index entry to exceed the limit.

Mongorestore and Mongoimport also cannot insert operations on a collection where the index key exceeds the limit.

In this release, the copy set's from node can still copy the document, even if the document's index key has exceeded the limit, but the warning message log is printed. It is also possible to continue indexing and rebuilding indexes on a collection that exceeds the index key limit, although a warning message log is printed.

For a set that has already been fragmented, the block merge operation will fail if the index has exceeded the index key limit.

Number of indexes per collection limit

The number of indexes for a single collection must not exceed 64.

Index name length limit

The fully qualified name of the index, including the namespace and the dot operator, must be no more than 128 characters long. Index name format: <database name>.<collection name>.$<index name>. By default, <index name> consists of the field names and index types that are indexed. You can also use the Ensureindex () method to customize this section.

Compound index Field Quantity limit

At most 31 characters can be Jianjian compound index at the same time.

Data

When you create a collection, if you specify the collection size (max must be less than 32 powers of 2), the collection is a fixed collection (capped collection), that is, the maximum number of documents capped collection is max. If the collection size is not specified, there is theoretically no limit to the number of files in the set.

Data size

A single Mongod instance cannot manage a dataset that exceeds the maximum virtual memory address space provided by the underlying operating system.

Virtual Memory Limit

Operating system

Record log

Log not logged

Linux

341

128T

Windows Server R2 and Windows 8.1

341

128T

Windows (otherwise)

4T

8T

Number of database collections

The maximum number of collections in a database is a function of the size of the number of files in the namespace and the index of the collection in the database.

Replica set

Number of replica set members

The number of replica set members is up to 12.

Number of replica set members with voting rights

When a vote is required, up to 7 members have the right to vote.

The size of the automatically created Oplog

If the Oplog size is not actively specified, the MongoDB created oplog must not exceed 50G.


Fragmented Cluster

Fragmentation Operation Restrictions

Group aggregation operations cannot be used on fragmented cluster environments and need to be replaced with mapreduce and aggregate if aggregation functions are required.

$isolated, Db.eavl (), $snapshot, geosearch commands are not supported in a fragmented environment.

Nesting is not supported $where operation.

Index overwrite Query

Index overlay queries are not supported in fragmented environments.

Fragment of an existing collection data

For a collection that already has data, the fragment operation is supported before its size is less than 256G.

Update operations on a single document for a fragmented collection

For all update () and remove () of a fragmented set, the query condition must include the slice key field or the _id field after the Justone or Multi:false attribute is specified.

Uniqueness index of a fragment set

MongoDB does not support the uniqueness index of a fragmented set unless it is prefixed with an index of the full slice key. The index in this case is the globally unique index.

Number of document limits for blocks that can be merged

If a block has more than 250,000 documents or more than 1.3 times times the block size, the block cannot be moved.

Key Limit

Slice key size

The key size must not exceed 512bytes.

Slice key Index Type

The slice key index can be an ascending index, a compound ascending index or a hash index starting with the slice key.

The TAB key index cannot be Multikey Index,text index or geospatial index.

Key cannot be changed

The slice key does not allow changes after fragmentation.

If you must change the key, you need to:

Dump all data

Drop Raw Piece Key collection

Using new slice keys to configure fragmentation

Divide the slice key range (make the fragment rule)

Re-import data

The slice key value cannot be changed

Once the set fragment succeeds, the value of the slice key is not allowed to be modified.

monotonic piecewise keys can limit the throughput of inserts

For clusters that require frequent insertion, the monotonic increment or decrement of the slice keys can affect the throughput of the insert. If your slice key is a _id field, note that the default value of the _id field is objectids with a universally added value.

When you insert a document with a monotone increment or decrement key, all inserts are executed on a fragmented block. After the insertion completes, the system will partition the block and migrate the data to ensure the uniformity of the data distribution.

This restriction does not affect the cluster if the data is modified and read while the hotspot operation is on the cluster.

To avoid this problem, using the hash key or the selected slice key value is not monotonic.

operator

Document sorting

For fields that are not indexed, the error occurs if the sorting phase produces a result set greater than 32M.

Aggregate pipeline operations

The memory usage in each phase of the pipeline cannot exceed 100M. Property Allowdiskuse can be set to true if a large data aggregation operation is performed.

Data size limits for write command operations

The write command cannot be greater than 1000 operations, and the MongoDB Bulk () operation does not have this restriction in comparison with the related functions in the driver.

Naming Restrictions

Database names are case-sensitive

Database names are case-sensitive

Database name restrictions on Windows operating systems

The name must not contain the following characters

/\. "*<>:|? and null characters

Database name restrictions on UNIX or Linux operating systems

The name must not contain the following characters

/\. "and null characters

Database command length

Length cannot exceed 64 characters

Collection Name Restrictions

The collection name must begin with _ and character, cannot contain $, null characters, and cannot begin with system.

Field Name Restrictions

Field names cannot contain. $ null characters


(url:http://blog.csdn.net/y943623901/article/details/41869071)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.