A component that has been an integral part of MongoDB database is a Storage Engine, which defines how data is stored in the disk. There may be different storage engines for a particular database and each one is productive in different aspects.

In previous versions of MongoDB, Memory Mapping(MMAP) has been the only storage engine but in version 3.0 and more, another storage engine, WiredTiger has been introduced which has its own benefits.

With these facilities we should be knowing which engine suits our application better.So Let’s differentiate between these two to know more on basis of certain characteristics..

Concurrency

MMAP uses Collection-level locking. In MongoDB 3.0 and more,if a client acquires a lock on a document to modify its content,then no other client can access the collection which holds the document currently. Whereas in earlier versions a single write operation acquires the lock to the database.

WiredTiger uses Document-Level Locking. Multiple clients can access the same collection, since the lock is acquired for that particular document.

In Case of parallel inserts and updates,WiredTiger would be extremely advantageous.

Consistency

Journaling is one feature that helps your database from recovery after a failure. MongoDB uses write ahead logging to on-disk journal files.

MMAP uses this feature to recover from failure.

In WiredTiger,a consistent view of the data is given by means of checkpoints. so that in case of failure it can rollback to the previous checkpoint. But journaling is required if the changes made after checkpoint is also needed.

It’s left to the user’s choice to enable or disable journaling.

Compression

Data compression is needed in places where the data growth is extremely fast which can be used to reduce the disk space consumed.

Data compression facilities is not present in MMAP storage engine.

In WiredTiger Storage Engine. Data compression is achieved using two methods

1.Snappy compression

2.Zlib

In Snappy method,compression rate is slow whereas in Zlib its high, And again, it’s the user’s preference to have it or not.

Memory Constraints

Wired Tiger can make use of multithreading and hence multi core CPU’s can be made use of it.whereas in MMAP, increasing the size of the RAM decreases the number of page faults which in turn increases the performance.

Learn about our BDR Suite.Try Now on a 30-days free trial: https://www.vembu.com/try/

To learn more about our products, please mail us at:vembu-support@vembu.com.

Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

Like what you read? Rate us