With version 3.0, MongoDB introduced the Pluggable
Storage Engine API. WiredTiger is one of the pluggable storage engines bundled with
MongoDB
Pluggable storage Engine API
MongoDB offers an API (application program interface)
that allows other applications to interact with MongoDB without using the MongoDB shell (mongod)
A storage engine is an interface between the database and
the hardware, A storage engine Doesn’t affect the way how you perform queries
on database, but it interferes with how data is written to, deleted from, and
read from disk and which data structure will be used for storing data.
This API makes feel comfortable for third parties to develop
their own storage engines for MongoDB. Before this API the only storage engine
was MMAPv1. MongoDB still uses this MMAPv1 and is the default storage engine in 3.0 and earlier.
In the 3.2 and above versions, WiredTiger is the default storage Engine. we can use the below command to check the storage engine being used.
>db.serverStatus().storageEngine
>db.serverStatus().storageEngine
MMAPv1
This storage engine is based on memory mapping. The drawback with
MMAPv1 was that if you have a lot of data to store, it quickly consumes an enormous
amount of disk space; MMAPv1 is supported on 64-bit Intel architectures
(x86_64) only. MongoDB returns an error when starting a mongod using MMAPv1 on
an unsupported architecture.
This is depreciated in 4.0 and will be removed from
future releases
Starting
with MongoDB Enterprise 3.2.6, the in-memory storage engine is part of general
availability (GA) in the 64-bit builds. Other than some metadata and diagnostic
data, the in-memory storage engine does not maintain any on-disk data,
including configuration data, indexes, user credentials, etc.
The in-memory storage engine does not write data to the file system but the data directory mentioned during with –dbpath maintains metadata.
Command to select this particular storage engine
mongod
--storageEngine inMemory --dbpath
This
storage or data will not be available once the instance is restarted.
WiredTiger Storage Engine (Default)
WiredTiger is a high-performance, scalable, open-source data
engine that focuses on multicore scalability and optimal RAM use.
WiredTiger requires a 64-bit OS system. starting from version 3.2 WiredTiger is the default storage engine.
This uses document-level concurrency control for write operations, this allows multiple users to perform operations at the same time.
When writing to disk; WiredTiger writes all data in the snapshot to disk in a consistent way across all datafiles.
This stores its data in a B-tree structure, providing highly efficient read and write performance.
For collections, WiredTiger uses Snappy compression by default, it can also provide gzip compression.
WiredTiger is a good default choice if you're not sure what to use or if you don't have a strong reason to use an alternative Of course, your choice of storage engine depends on your application use case, and there are situations in which WiredTiger is not the optimal pick.
When writing to disk; WiredTiger writes all data in the snapshot to disk in a consistent way across all datafiles.
This stores its data in a B-tree structure, providing highly efficient read and write performance.
For collections, WiredTiger uses Snappy compression by default, it can also provide gzip compression.
WiredTiger is a good default choice if you're not sure what to use or if you don't have a strong reason to use an alternative Of course, your choice of storage engine depends on your application use case, and there are situations in which WiredTiger is not the optimal pick.
For example, users with many large documents in separate collections, or users with a mostly read-only workload, may want to choose MMAPv1 instead.
0 comments:
Post a Comment