MongoDB WiredTiger


Example

WiredTiger supports LSM trees to store indexes. LSM trees are faster for write operations when you need to write huge workloads of random inserts.

In WiredTiger, there is no in-place updates. If you need to update an element of a document, a new document will be inserted while the old document will be deleted.

WiredTiger also offers document-level concurrency. It assumes that two write operations will not affect the same document, but if it does, one operation will be rewind and executed later. That's a great performance boost if rewinds are rare.

WiredTiger supports Snappy and zLib algorithms for compression of data and indexes in the file system. Snappy is the default. It is less CPU-intensive but have a lower compression rate than zLib.

How to use WiredTiger Engine

mongod --storageEngine wiredTiger --dbpath <newWiredTigerDBPath>

Note:

  1. After mongodb 3.2, the default engine is WiredTiger.
  2. newWiredTigerDBPath should not contain data of another storage engine. To migrate your data, you have to dump them, and re-import them in the new storage engine.
    mongodump --out <exportDataDestination>
    mongod --storageEngine wiredTiger --dbpath <newWiredTigerDBPath>
    mongorestore <exportDataDestination>