MongoDB Questions and Answers – Optimization Strategies – 1

«
»

This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “Optimization Strategies – 1”.

1. Which of the following setting defines what constitutes a “slow” operation?
a) slowOpThresholdGs
b) fastOpThresholdMs
c) slowOpThresholdMs
d) none of the mentioned
View Answer

Answer: c
Explanation: The operationProfiling.slowOpThresholdMs setting is available only for mongod.

advertisement

2. Point out the correct statement.
a) MongoDB uses a locking system to ensure data set consistency
b) If certain operations are long-running or a queue forms, performance will degrade as requests and operations wait for the lock
c) Long queries can result from ineffective use of indexes
d) All of the mentioned
View Answer

Answer: d
Explanation: Lock-related slowdowns can be intermittent.

3. ________ provide the number of times the lock acquisitions encountered deadlocks.
a) locks.deadlock
b) lock.deadlockCount
c) locks.deadlockCount
d) all of the mentioned
View Answer

Answer: c
Explanation: The globalLock data structure contains information regarding the database’s current lock state, historical lock status, current operation queue, and the number of active clients.

advertisement
advertisement

4. If __________ is high relative to uptime, the database has existed in a lock state for a significant amount of time.
a) globalLock.halfTime
b) globalLock.totalTime
c) globalLock.downTime
d) all of the mentioned
View Answer

Answer: b
Explanation: The value of totalTime represents the time, in microseconds, since the database last started and creation of the globalLock.

5. Point out the wrong statement.
a) The storage.wiredTiger.indexConfig.prefixCompression setting does not affect all indexes created
b) Database profiling can impact database performance
c) The default storage.wiredTiger.engineConfig.cacheSizeGB setting assumes that there is a single mongod instance per node
d) None of the mentioned
View Answer

Answer: a
Explanation: If you change the value of storage.wiredTiger.indexConfig.prefixCompression on an existing MongoDB deployment, all new indexes will use prefix compression.

advertisement

6. The __________ data structure value provides more granular information concerning the number of operations queued because of a lock.
a) currentQueue
b) curQueue
c) currentQu
d) none of the mentioned
View Answer

Answer: a
Explanation: The serverStatus command returns a document that provides an overview of the database process’s state

7. serverStatus includes all fields by default, except _________
a) rangeDeleter
b) rangeDelete
c) rangeDEL
d) none of the mentioned
View Answer

Answer: b
Explanation: You may only dynamically include top-level fields from the serverStatus document that are not included by default.

advertisement

8. ______ field contains total number of current clients that connect to the database instance.
a) available
b) current
c) always avail
d) none of the mentioned
View Answer

Answer: b
Explanation: available contains the total number of unused connections available for new clients.

9. MongoDB’s _______ is a database profiling system that can help identify inefficient queries and operations.
a) Reporter
b) Executer
c) Profiler
d) None of the mentioned
View Answer

Answer: c
Explanation: Enable the profiler by setting the profile value using the following command in the mongo shell.

advertisement

Sanfoundry Global Education & Learning Series – MongoDB.

Here’s the list of Best Reference Books in MongoDB.

Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

advertisement
advertisement
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn | Youtube | Instagram | Facebook | Twitter