Refer to the exhibit. Based on the provided YAML configuration snippet, what will be the behavior of the mongod instance regarding memory allocation on a host with 16GB of total system RAM?
Exhibit
storage:
dbPath: /var/lib/mongodb
wiredTiger:
engineConfig:
cacheSizeGB: 2Trap 1: The instance will use 7.5GB for the WiredTiger cache.
This value represents the default calculation (50% of 16GB minus 1GB) that MongoDB would use if the cacheSizeGB parameter was omitted. Since the configuration file explicitly defines a size of 2GB, the default calculation is ignored by the storage engine during the initialization of the WiredTiger process.
Trap 2: The total resident memory (RSS) will not exceed 2GB.
WiredTiger's cache size only accounts for the internal storage engine cache, not the total memory consumed by the mongod process. The process will also use memory for connections, aggregations, and the filesystem cache. Therefore, the total resident memory will almost always exceed the 2GB limit specified in the configuration.
Trap 3: The mongod process will fail to start due to a memory mismatch.
Setting a cache size lower than the default is a valid configuration and will not prevent the server from starting. MongoDB does not enforce a minimum cache size relative to system RAM, though performance may suffer if the cache is too small to hold the working set of the database.
- A
The instance will use 7.5GB for the WiredTiger cache.
Why it fails: This value represents the default calculation (50% of 16GB minus 1GB) that MongoDB would use if the cacheSizeGB parameter was omitted. Since the configuration file explicitly defines a size of 2GB, the default calculation is ignored by the storage engine during the initialization of the WiredTiger process.
- B
The internal cache will be capped strictly at 2GB.
The 'cacheSizeGB' setting explicitly defines the maximum amount of RAM that WiredTiger uses for its internal cache. When this value is set in the configuration file, it overrides the default heuristic. This is essential for managing server resources when other processes also require significant portions of system memory.
- C
The total resident memory (RSS) will not exceed 2GB.
Why it fails: WiredTiger's cache size only accounts for the internal storage engine cache, not the total memory consumed by the mongod process. The process will also use memory for connections, aggregations, and the filesystem cache. Therefore, the total resident memory will almost always exceed the 2GB limit specified in the configuration.
- D
The mongod process will fail to start due to a memory mismatch.
Why it fails: Setting a cache size lower than the default is a valid configuration and will not prevent the server from starting. MongoDB does not enforce a minimum cache size relative to system RAM, though performance may suffer if the cache is too small to hold the working set of the database.