MongoDB Documentation, Release 3.0.4 Storage Views used in Journaling How Journaling Records Write Operations With journaling, MongoDB’s storage layer has two internal views of the data set. The shared view stores modified data for upload to the MongoDB data files. The shared view is the only view with direct access to the MongoDB data files. When running with journaling, mongod asks the operating system to map your existing on-disk data files to the shared view virtual memory view. The operating system maps the files but does not load them. MongoDB later loads data files into the shared view as needed. The private view stores data for use with read operations (page 60). The private view is the first place MongoDB applies new write operations (page 73). Upon a journal commit, MongoDB copies the changes made in the private view to the shared view , where they are then available for uploading to the database data files. The journal is an on-disk view that stores new write operations after MongoDB applies the operation to the private view but before applying them to the data files. The journal provides durability. If the mongod instance were to crash without having applied the writes to the data files, the journal could replay the writes to the shared view for eventual upload to the data files. MongoDB copies the write operations to the journal in batches called group commits. These “group commits” help minimize the performance impact of journaling, since a group commit must block all writers during the commit. See commitIntervalMs for information on the default commit interval. Journaling stores raw operations that allow MongoDB to reconstruct the following: As write operations (page 73) occur, MongoDB writes the data to the private view in RAM and then copies the write operations in batches to the journal. The journal stores the operations on disk to ensure durability. Each journal entry describes the bytes the write operation changed in the data files. MongoDB next applies the journal’s write operations to the shared view . At this point, the shared view becomes inconsistent with the data files. At default intervals of 60 seconds, MongoDB asks the operating system to flush the shared view to disk. This brings the data files up-to-date with the latest write operations. The operating system may choose to flush the shared view to disk at a higher frequency than 60 seconds, particularly if the system is low on free memory. When MongoDB flushes write operations to the data files, MongoDB notes which journal writes have been flushed. Once a journal file contains only flushed writes, it is no longer needed for recovery, and MongoDB either deletes it or recycles it for a new journal file. As part of journaling, MongoDB routinely asks the operating system to remap the shared view to the private view , in order to save physical RAM. Upon a new remapping, the operating system knows that physical memory pages can be shared between the shared view and the private view mappings. Note: The interaction between the shared view and the on-disk data files is similar to how MongoDB works without journaling, which is that MongoDB asks the operating system to flush in-memory changes back to the data files every 60 seconds. 5.3. Administration Reference 309 • document insertion/updates • index modifications • metadata changes to the namespace files • creation and dropping of databases and their associated data files