How to change MongoDB slowOpThresholdMs in mongo shell
-
30-09-2020 - |
Question
I need to decrease the slowms trash hold to 50, can't find the way of doing that without restarting the mongod process.
Solution
The slowOpThresholdMs
setting defines what constitutes a “slow” operation. To set the threshold which the profiler considers operations “slow” (and thus, included in the level 1 profiling data
), you can configure slowOpThresholdMs
at runtime as an argument to the db.setProfilingLevel()
operation.
For Ref setProfilingLevel and slowOpThresholdMs
Note: The threshold for slow operations applies to the entire mongod instance. When you change the threshold, you change it for all databases on the instance.
For Example:
{ profile: 1, slowms: 200 }
Database profiling can impact database performance. Enable this option only after careful consideration
OTHER TIPS
Try this: db.setProfilingLevel( 1, 50)