Bird
Raised Fist0
MongoDBquery~20 mins

Memory and storage engine basics (WiredTiger) in MongoDB - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
WiredTiger Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
WiredTiger Cache Size Calculation
If a MongoDB instance uses the WiredTiger storage engine on a server with 16 GB of RAM, what is the default WiredTiger cache size allocated by MongoDB?
A4 GB (25% of RAM)
B12 GB (75% of RAM)
C8 GB (50% of RAM minus 1 GB)
D15 GB (almost all RAM)
Attempts:
2 left
💡 Hint
MongoDB reserves some RAM for the OS and other processes, so WiredTiger cache is less than total RAM.
❓ query_result
intermediate
2:00remaining
WiredTiger Cache Usage Query Result
What is the output of this MongoDB command showing WiredTiger cache statistics? db.serverStatus().wiredTiger.cache
MongoDB
db.serverStatus().wiredTiger.cache
A{"bytes currently in the cache": 104857600, "maximum bytes configured": 8589934592, "tracked dirty bytes in the cache": 5242880}
B{"cache hits": 1000, "cache misses": 500, "cache evictions": 200}
C{"total pages read": 10000, "total pages written": 8000}
D{"connections current": 50, "connections available": 100}
Attempts:
2 left
💡 Hint
Look for cache size and bytes info in the WiredTiger cache stats.
📝 Syntax
advanced
2:00remaining
Correct WiredTiger Cache Size Configuration Syntax
Which of the following is the correct way to set WiredTiger cache size to 2 GB in the MongoDB configuration file (mongod.conf)?
A
storage:
  wiredTiger:
    engineConfig:
      cacheSizeGB: 2
B
storage:
  wiredTiger:
    cacheSizeGB: 2
C
wiredTiger:
  engineConfig:
    cacheSizeGB: 2
D
storage:
  engineConfig:
    wiredTiger:
      cacheSizeGB: 2
Attempts:
2 left
💡 Hint
Check the correct nesting of keys under storage and wiredTiger.
❓ optimization
advanced
2:00remaining
Improving WiredTiger Write Performance
Which WiredTiger configuration option can improve write performance by reducing fsync frequency, but increases risk of data loss on crash?
AdirectoryForIndexes: true
BsyncPeriodSecs: 60
CcacheSizeGB: 4
DjournalCompressor: snappy
Attempts:
2 left
💡 Hint
Look for an option that controls how often data is flushed to disk.
🔧 Debug
expert
3:00remaining
Diagnosing WiredTiger Cache Pressure Issue
A MongoDB server using WiredTiger shows frequent cache pressure warnings and slow queries. Which of the following is the most likely cause?
AJournaling is disabled causing data loss
BThe database has too many indexes
CMongoDB is running on a single CPU core
DWiredTiger cache size is too small for the working set
Attempts:
2 left
💡 Hint
Cache pressure warnings relate to memory usage and cache eviction.

Practice

(1/5)
1. What is the default storage engine used by MongoDB that balances speed and storage?
easy
A. WiredTiger
B. MMAPv1
C. InMemory
D. RocksDB

Solution

  1. Step 1: Recall MongoDB default engine

    MongoDB uses WiredTiger as its default storage engine since version 3.2 for better performance and compression.
  2. Step 2: Compare options

    MMAPv1 is older, InMemory is for volatile data, RocksDB is not default in MongoDB.
  3. Final Answer:

    WiredTiger -> Option A
  4. Quick Check:

    Default engine = WiredTiger [OK]
Hint: Default MongoDB engine is WiredTiger [OK]
Common Mistakes:
  • Confusing MMAPv1 as default
  • Thinking InMemory is default
  • Assuming RocksDB is default
2. Which configuration file setting correctly specifies WiredTiger as the storage engine in mongod.conf?
easy
A. storage: engine: wiredtiger
B. storage: engine: WT
C. storage: engine: wiredTiger
D. storage: engine: WiredTiger

Solution

  1. Step 1: Check correct case for engine name

    The engine name is case-sensitive and must be 'wiredTiger' with lowercase 'w' and capital 'T'.
  2. Step 2: Validate YAML syntax

    storage: engine: WT uses unrecognized abbreviation; C uses all lowercase; D uses incorrect capitalization.
  3. Final Answer:

    storage: engine: wiredTiger -> Option C
  4. Quick Check:

    Correct engine name is wiredTiger [OK]
Hint: Use exact 'wiredTiger' (lowercase w, capital T) in config [OK]
Common Mistakes:
  • Using all lowercase 'wiredtiger'
  • Using 'WiredTiger' with capital W
  • Using abbreviations like 'WT'
3. Given this mongod.conf snippet:
storage:
  engine: WiredTiger
  wiredTiger:
    engineConfig:
      cacheSizeGB: 2

What does the cacheSizeGB setting control?
medium
A. The disk space allocated for WiredTiger files
B. The amount of RAM WiredTiger uses for caching data
C. The number of CPU cores WiredTiger uses
D. The network bandwidth limit for WiredTiger

Solution

  1. Step 1: Understand cacheSizeGB meaning

    cacheSizeGB sets how much RAM WiredTiger uses to cache data in memory for faster access.
  2. Step 2: Eliminate other options

    It does not control disk space, CPU cores, or network bandwidth.
  3. Final Answer:

    The amount of RAM WiredTiger uses for caching data -> Option B
  4. Quick Check:

    cacheSizeGB = RAM cache size [OK]
Hint: cacheSizeGB sets RAM cache size for WiredTiger [OK]
Common Mistakes:
  • Thinking it controls disk space
  • Confusing with CPU or network settings
  • Ignoring memory tuning importance
4. You set cacheSizeGB: 0.5 in mongod.conf but MongoDB starts with poor performance. What is the likely cause?
medium
A. cacheSizeGB must be at least 1 GB
B. cacheSizeGB cannot be a decimal value
C. cacheSizeGB must be set under storage.engine directly
D. cacheSizeGB is ignored and does not affect startup

Solution

  1. Step 1: Check WiredTiger cache size limits

    WiredTiger performs poorly if cacheSizeGB is less than 1 GB.
  2. Step 2: Validate config placement and value type

    Decimal values are allowed; placement under wiredTiger.engineConfig is correct; it is not ignored.
  3. Final Answer:

    cacheSizeGB must be at least 1 GB -> Option A
  4. Quick Check:

    Minimum cacheSizeGB = 1 GB [OK]
Hint: cacheSizeGB minimum is 1 GB for good performance [OK]
Common Mistakes:
  • Using decimal values thinking they are invalid
  • Placing cacheSizeGB under wrong config section
  • Assuming cacheSizeGB is optional for startup
5. You want to optimize MongoDB performance on a server with 16 GB RAM. Which cacheSizeGB setting is best for WiredTiger, considering MongoDB and OS need memory?
hard
A. Set cacheSizeGB to 14 to maximize cache
B. Set cacheSizeGB to 16 to use all RAM for cache
C. Set cacheSizeGB to 2 because more cache slows down MongoDB
D. Set cacheSizeGB to 8 to leave memory for OS and other processes

Solution

  1. Step 1: Understand memory needs

    MongoDB needs memory for cache and other operations; OS and other apps also need RAM.
  2. Step 2: Choose balanced cache size

    Setting cacheSizeGB to about half or slightly more (8 GB) leaves enough RAM for OS and avoids swapping.
  3. Step 3: Evaluate other options

    14 or 16 GB risks OS starvation; 2 GB is too low for good performance.
  4. Final Answer:

    Set cacheSizeGB to 8 to leave memory for OS and other processes -> Option D
  5. Quick Check:

    Balance cache and OS memory = 8 GB [OK]
Hint: Use about half RAM for cache to keep system stable [OK]
Common Mistakes:
  • Assigning all RAM to cache causing OS issues
  • Setting too low cacheSizeGB hurting performance
  • Ignoring OS memory needs
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard