Databases Reference
In-Depth Information
Figure C-1. Namespaces and extents
Figure C-1 shows us several interesting things about namespaces and extents. Each
namespace can have several different extents, which are not (necessarily) contiguous
on disk. Like data files for a database, extents for a namespace grow in size with each
new allocation. This is done to balance wasted space used by a namespace versus the
desire to keep data for a namespace mostly contiguous on disk. The figure also shows
a special namespace, $freelist , which keeps track of extents that are no longer in use
(e.g., extents from a dropped collection or index). When a namespace allocates a new
extent, it will first search the freelist to see whether an appropriately sized extent is
available.
Memory-Mapped Storage Engine
The default storage engine (and only supported storage engine at the time of this writ-
ing) for MongoDB is a memory-mapped engine. When the server starts up, it memory
maps all its data files. It is then the responsibility of the operating system to manage
flushing data to disk and paging data in and out. This storage engine has several im-
portant properties:
• MongoDB's code for managing memory is small and clean, because most of that
work is pushed to the operating system.
• The virtual size of a MongoDB server process is often very large, exceeding the size
of the entire data set. This is OK, because the operating system will handle keeping
the amount of data resident in memory contained.
 
Search WWH ::




Custom Search