Wiredtiger vs MMap Storage engine difference

mongodb

I don't get exactly which are the difference between the storage engines in mongodb.
Besides those:

  • concurrency (collection lock MMap – document lock WT)
  • in-place updates (Yes MMap – No WT)
  • data compression (No MMap – Yes WT)

which are the others? For example about journaling..

Best Answer

There are too many differences to summarise in an answer here, but at a high level I'd say "WiredTiger is the future" and "MMAP is the past".

WiredTiger is the default storage engine for new deployments of MongoDB 3.2+, and some MongoDB features in recent releases (eg. Config Servers as Replica Sets aka CSRS) rely on WiredTiger. There is significant engineering effort being invested in improving WiredTiger and achieving levels of concurrency, correctness, and consistency that are not possible with MMAP (for example, passing the rigorous Jepsen tests for distributed databases).

Aside from differences you've mentioned like improved concurrency and compression (which applies to both data and indexes), WiredTiger also includes features such as cache management, better utilisation of hardware resources, data integrity checksums, and a solid code base for building more advanced storage features.

Some of these features are not directly comparable without an understanding of the storage engine implications. For example, with MMAP there was an emphasis on designing schema for in-place updates since document moves involve more expensive index updates: indexes in MMAP point directly to a file location and offset. WiredTiger has a level of indirection for index entries and uses MVCC internally to enable document-level concurrency and transactional document updates.

The WiredTiger storage engine has analogous settings to MMAP's journal and disk flush intervals, but details such as the in-memory and on-disk data formats are managed by the storage engine.

For more information, see:

Related Topic