DBDB.io The Encyclopedia of Database Systems · Est. 2017
Database of Databases

Database Entry

WiredTiger


WiredTiger is an open-source key/value storage engine for NoSQL databases and is currently the default storage engine for MongoDB.

Source Code
https://github.com/wiredtiger/wiredtiger[02]
Developer
Country of Origin
AU, US
Start Year
2008 [11]
Acquired By
Project Types
Commercial, Open Source
Written in
C
Supported Languages
C, Java, Python
Inspired By
LevelDB
Compatible With
LevelDB, RocksDB
Operating Systems
Linux, Windows
Licenses
GPL v2, GPL v3

WiredTiger supports both B-tree and log-structured merge tree for data storage. It also supports both row store and column store. WiredTiger employs multi-version concurrency control for better scalability on multi-core architectures and supports several standard isolation levels. Though WiredTiger is often considered as a storage engine, it also has some basic schema support where schemas are provided by users at runtime.

WiredTiger is developed in C and provides Java/Python language bindings. It has a set of APIs that is compatible with LevelDB.

Database Entry

WiredTiger


WiredTiger is an open-source key/value storage engine for NoSQL databases and is currently the default storage engine for MongoDB.

WiredTiger supports both B-tree and log-structured merge tree for data storage. It also supports both row store and column store. WiredTiger employs multi-version concurrency control for better scalability on multi-core architectures and supports several standard isolation levels. Though WiredTiger is often considered as a storage engine, it also has some basic schema support where schemas are provided by users at runtime.

WiredTiger is developed in C and provides Java/Python language bindings. It has a set of APIs that is compatible with LevelDB.

History[05]


The development of the WiredTiger storage engine started in November 2018. The corresponding company WiredTiger Software was founded in 2012 and was later acquired by MongoDB to replace its original mmap-based storage engine as the default storage engine.

Checkpoints[06][07]


Checkpoints in WiredTiger are different from typical checkpoints in other database systems. In WiredTiger, the block storage manager is actually managing multiple versions of checkpoints, i.e. all the durable data in WiredTiger are considered as checkpoints. Checkpoint process in WiredTiger are triggered every 60 seconds or manually triggered.

A successful checkpoint in WiredTiger requires four phases. We will take B-tree as an example in the following discussion of these phases. First, all dirty leaf pages are written to disk. Then all dirty internal pages are written to disk. Then fsync is called on the checkpoint file so that the checkpoint is persistent in disk. Finally, the new root of the B-tree is atomically changed to the new root. This is somewhat similar to shadow paging. When a checkpoint is deleted, WiredTiger will check whether there is any dependency between the two adjacent checkpoints and merge them if there are common pages in the two B-trees.

Compression[08][09]


Multiple compression techniques are used in WiredTiger.

Block-level: Existing compression libraries can be directly plugged into WiredTiger. It supports LZ4, snappy, zlib, and Zstd.

Record-level: WiredTiger supports dictionary encoding, run-length encoding, prefix encoding, and Huffman encoding.

Concurrency Control[10]


WiredTiger employs multi-version concurrency control (MVCC), in which readers never block writers. In case of write-write conflict, one transaction will be rolled back and retried. Three isolation levels are provided: READ_UNCOMMITTED, READ_COMMITTED, and SNAPSHOT. READ_COMMIT is the default isolation level. In addition, transactions' working set is required to fit in main memory in WiredTiger.

In WiredTiger, transactions can pin particular versions of the database, which are called "named snapshots". Queries within such transactions are executed as if they are operating on the named snapshots.

Indexes


Storage Architecture


System Architecture


Citations

11 sources
  1. MongoDB: The World’s Leading Modern Data Platform | MongoDB mongodb.com
  2. GitHub - wiredtiger/wiredtiger: WiredTiger's source tree · GitHub github.com
  3. WiredTiger: Reference Guide wiredtiger.com
  4. WiredTiger - Wikipedia wikipedia.org
  5. https://www.mongodb.com/press/wired-tiger mongodb.com Dead — Check Archive
  6. Checkpoints · wiredtiger/wiredtiger Wiki · GitHub github.com
  7. A Technical Introduction to WiredTiger | PPTX slideshare.net
  8. WiredTiger: File formats and compression wiredtiger.com
  9. WiredTiger: Compressors wiredtiger.com
  10. WiredTiger: Transactions wiredtiger.com
  11. First real build infra-structure -- I can now configure and build a static library with a single file. --HG-- branch : keith github.com
Revision #9