The previous article introduced HTTP/2, a brief introduction to MongoDB 3.0, released March 3.
What ' s new in MongoDB 3.0? New Storage Engine Wiredtiger
The storage engine for MongoDB 3.0 is plug-in and defaults to the new Wiredtiger. Wiredtiger compared to the advantages of the original MMAPV1 engine:
This improvement has been long awaited Ah, MongoDB's lock granularity has been criticized, according to our actual experience MongoDB in high concurrency read-write mixed scenario performance is poor.
- Higher compression ratios
The new MongoDB uses prefix compression (Prefix Compression), which greatly improves the compression ratio of the index data. It is very objective to look at the simple test results from our OPS colleague:
- Write Performance improvement
The official saying was raised 7-10 times, from our simple test results, although not so exaggerated but there are really no small increase:
Our 2.x version test results are probably less than 2w.
Note: Wiredtiger can only be used on 64-bit machines.
Improvement of the MMAPV1 engine
Although the new Wiredtiger, but the original MMAPV1 engine has also been improved.
- New record allocation policy
MongoDB 3.0 uses power of 2 allocation instead of the original dynamic record allocation and discards the paddingfactor.
The original allocation strategy when the document becomes larger than the initial allocation size, MongoDB to allocate a new record, and to move the data and update the index, resulting in storage fragmentation. power of 2 allocation
The strategy is that the size of the assigned record is 2 times (32, 64, 128, 256, 512 ...). 2MB), each record includes the document itself and additional space--padding, which reduces the amount of time the document is recorded for redistribution and data movement when it grows.
It is clear that the new strategy is more efficient in scenarios where large documents and documents are growing frequently, but if only insert manipulation and so-called In-place update operations (which do not grow the document size), using this strategy can be a waste of space, so MongoDB 3.0 allows you to turn this policy off.
Although the lock granularity without wiredtiger is small, it is a very important improvement compared to the previous MMAPv1.
Explain
New explain, similar to the MySQL query plan, is useful when performing tuning.
Improvements to the query API
Aggregate () added the $datetostring operator, which supports converting logs to a specified format
Query new $EQ operator supports equality judgment
Index
- The background creation index is not interrupted by Dropdatabase,drop and dropindexes operations.
Tools
The main features of Mongodump and Mongorestore are improved.
The new Java driver
A simple look at the source, the original API is still compatible, but rewrite a lot of major classes (Mongocollection,mongodatabase), the new mongoiterable interface style is much like the Java8 stream, and are generic. Provides asynchronous mongoclient, a new coding framework that improves performance.
Official documents
MongoDB 3.0
New Year's technology: MongoDB 3.0