/    /  MongoDB – WiredTiger Storage

MongoDB – WiredTiger Storage:

WiredTiger is a storage engine which is introduced from MONGODB 3.0 version for 64-bit and this became default storage engine from MONGODB 3.2.

Document Level Concurrency

WiredTiger manages write operations well by controlling document-level concurrency. So that, multiple clients can modify different documents of a collection at same time.

Snapshots and Checkpoints

WiredTiger implements MultiVersion Concurrency Control (MVCC) method. The simplest way is to make all readers wait until the writer is done, which is known as a lock which is very slow, so MVCC takes a different approach like that each user connected to the database sees a snapshot of the database at a particular point in time. Any changes made by a writer will not be seen by other users of the database until the changes have been completed. WiredTiger writes all the data in a snapshot to disk in a consistent way across all data files. That data act as a checkpoint in the data files. The checkpoint ensures that the data files are consistent. MongoDB configures WiredTiger to create checkpoints at intervals of 60 seconds or 2 gigabytes of journal data.

Journal

WiredTiger uses a write-ahead transaction log in combination with checkpoints to ensure data durability. The WiredTiger journal persists all data modifications between checkpoints. If MongoDB exits between checkpoints, it uses the journal to replay all data modified since the last checkpoint.

Compression

With WiredTiger, MongoDB supports compression for all collections and indexes. Compression minimizes storage but consumes additional CPU.WiredTiger uses block compression for collections with the snappy compression library and for indexes using prefix compression. Minimum log record size for WiredTiger is 128 bytes. WiredTiger does not compress if it smaller than that.You can disable journaling by setting storage.journal.enabled to false, which can reduce the overhead of maintaining the journal.

Memory Use

MongoDB utilizes both the WiredTiger internal cache and the filesystem cache. From version 3.4, the WiredTiger internal cache size would be 50% of RAM minus 1 GB, or 256 MB whatever larger.