Database Reference
In-Depth Information
Level
Description
0
This indicates that profiling is disabled
1
This refers to only slow log operations
2
This refers to all log operations
When using the first level of profiling, the database's profiler doesn't save anything related
to operations. With level 1, the profiler logs slow operations.
There is a setting parameter that defines the slow operations threshold. Using the
slowOpThresholdMs configuration parameter, you can define a threshold for slow op-
erations. Then, the profiler logs operations with slower execution time than the defined
value.
To define the slowOpThresholdMs parameter, you can either use a configuration file
to define the value or you can pass the value to the second parameter of the setPro-
filingLevel function, as explained earlier.
By using level 2 of profiling, the profiler records all operations without considering any
conditions.
To understand the structure of this function better, consider the following command:
db.setProfilingLevel(1, 1000)
After issuing the preceding command, the database profiler records all operations with an
execution time greater than 1000 milliseconds.
Note
Using the profiler negatively affects performance because the profiler records redundant
data for a part, or the entire database operations. It's recommended to keep it off unless
you need to diagnose the database.
After configuring the profiler engine, you can query logs from database using the sys-
tem.profile collection.
Search WWH ::




Custom Search