mongodb

数据库 系统性能、负载和容量

Cursor Isolation

Because the cursor is not isolated during its lifetime, intervening write operations on a document may result in a cursor that returns a document more than once if that document has changed. To handle this situation, see the information on snapshot mode

 

为了实现低延迟的数据库操作MongoDB中广泛使用了RAM。在MongoDB中,所有的数据都是通过内存映射文件读取和操作的。从内存中读取数据是使用纳秒来度量的,而从磁盘中读取数据则是使用毫秒度量的,所以从内存中读取数据几乎比从磁盘中读取要快了十万倍。

 

MongoDB能够使用本地附加的存储和固态硬盘(SSD)

Sharding可以让MongoDB的部署解决单个服务器的硬件限制而不需要增加应用程序的复杂性,解决的硬件限制包括RAM和磁盘I/O的瓶颈。

 

The maximum BSON document size is 16 megabytes.

索引优化查询

All indexes in MongoDB are B-tree indexes

A single collection can have no more than 64 indexes;There can be no more than 31 fields in a compound index;

The total size of an index entry, which can include structural overhead depending on the BSON type, must be less than 1024 bytes.

By default, all collections have an index on the _id field

By default, creating an index blocks all other operations on a database. When building an index on a collection, the database that holds the collection is unavailable for read or write operations until the index build completes. Any operation that requires a read or write lock on all databases (e.g. listDatabases) will wait for the foreground index build to complete.

可以考虑background模式执行建立索引

MongoDB allows you to specify a unique constraint on an index. These constraints prevent applications from inserting documents that have duplicate values for the inserted fields. Additionally, if you want to create an index on a collection that has existing data that might have duplicate values for the indexed field, you may choose to combine unique enforcement with duplicate dropping.

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。