MongoDB Documentation, Release 3.0.4 MMAPv1 Storage Engine 3.2. MongoDB CRUD Concepts 91 MMAPv1 is MongoDB’s original storage engine based on memory mapped files. It excels at workloads with high volume inserts, reads, and in-place updates. MMAPv1 is the default storage engine in MongoDB 3.0 and all previous versions. Journal In order to ensure that all modifications to a MongoDB data set are durably written to disk, MongoDB records all modifications to a journal that it writes to disk more frequently than it writes the data files. The journal allows MongoDB to successfully recover data from data files after a mongod instance exits without flushing all changes. See Journaling Mechanics (page 308) for more information about the journal in MongoDB. Record Storage Characteristics All records are contiguously located on disk, and when a document becomes larger than the allocated record, MongoDB must allocate a new record. New allocations require MongoDB to move a document and update all indexes that refer to the document, which takes more time than in-place updates and leads to storage fragmentation. Changed in version 3.0.0. By default, MongoDB uses Power of 2 Sized Allocations (page 91) so that every document in MongoDB is stored in a record which contains the document itself and extra space, or padding . Padding allows the document to grow as the result of updates while minimizing the likelihood of reallocations. Record Allocation Strategies MongoDB supports multiple record allocation strategies that determine how mongod adds padding to a document when creating a record. Because documents in MongoDB may grow after insertion and all records are contiguous on disk, the padding can reduce the need to relocate documents on disk following updates. Relocations are less efficient than in-place updates and can lead to storage fragmentation. As a result, all padding strategies trade additional space for increased efficiency and decreased fragmentation. Different allocation strategies support different kinds of workloads: the power of 2 allocations (page 91) are more efficient for insert/update/delete workloads; while exact fit allocations (page 91) is ideal for collections without update and delete workloads. MongoDB 3.0 uses the power of 2 sizes allocation as the default record allocation strategy for MMAPv1. With the power of 2 sizes allocation strategy, each record has a size in bytes that is a power of 2 (e.g. 32, 64, 128, 256, 512 ... 2MB). For documents larger than 2MB, the allocation is rounded up to the nearest multiple of 2MB. The power of 2 sizes allocation strategy has the following key properties: Power of 2 Sized Allocations Changed in version 3.0.0. No Padding Allocation Strategy Changed in version 3.0.0. For collections whose workloads do not change the document sizes, such as workloads that consist of insert- only operations or update operations that do not increase document size (such as incrementing a counter), you • Can efficiently reuse freed records to reduce fragmentation. Quantizing record allocation sizes into a fixed set of sizes increases the probability that an insert will fit into the free space created by an earlier document deletion or relocation. • Can reduce moves. The added padding space gives a document room to grow without requiring a move. In addition to saving the cost of moving, this results in less updates to indexes. Although the power of 2 sizes strategy can minimize moves, it does not eliminate them entirely.