What is the WiredTiger storage engine?
Why Interviewers Ask This
Candidates at the intermediate level are expected to not only know this concept but explain the trade-offs involved. Interviewers use this question to see if you can reason about design decisions, not just recall facts.
Answer
WiredTiger is MongoDB's default and primary storage engine since MongoDB 3.2, developed by the creators of BerkeleyDB. It replaced the older MMAPv1 engine. Key features: (1) MVCC (Multi-Version Concurrency Control): document-level concurrency — multiple readers/writers can access different documents simultaneously without blocking each other. Old MMAPv1 used collection-level locking (one write at a time per collection); (2) Compression: WiredTiger compresses all data on disk. Default: Snappy compression (fast, moderate ratio). Options: zlib (better compression, slower), zstd (best compression, modern), none. Typically reduces storage by 50-80%; (3) Data integrity: checksum verification for data corruption detection — WiredTiger validates data on read; (4) Write-ahead logging (journaling): WiredTiger uses a WAL (journal) for crash recovery and data durability; (5) Cache management: WiredTiger has its own internal cache (default: 50% of RAM minus 1GB, min 256MB) separate from the OS page cache. Configure: storage.wiredTiger.engineConfig.cacheSizeGB; (6) B-tree storage: data and indexes stored as B-trees. MongoDB In-Memory engine: alternative storage engine — keeps all data in RAM, no persistence. Ultra-fast for temporary/cache data. Enterprise-only. Encrypted storage engine: WiredTiger supports at-rest encryption (MongoDB Enterprise). Monitoring WiredTiger: db.serverStatus().wiredTiger shows cache usage, evictions, and compression stats.
Pro Tip
This topic has MongoDB-specific nuances that differ from general programming. Highlighting those nuances in your answer shows expertise rather than generic knowledge.