OPTIONS
翻译或纠错本页面

profile

profile

Use the profile command to enable, disable, or change the query profiling level. This allows administrators to capture data regarding performance. The database profiling system can impact performance and can allow the server to write the contents of queries to the log. Your deployment should carefully consider the security implications of this. Consider the following prototype syntax:

{ profile: <level> }

The following profiling levels are available:

Level Setting
-1 No change. Returns the current profile level.
0 Off. No profiling.
1 On. Only includes slow operations.
2 On. Includes all operations.

You may optionally set a threshold in milliseconds for profiling using the slowms option, as follows:

{ profile: 1, slowms: 200 }

mongod writes the output of the database profiler to the system.profile collection.

mongod records queries that take longer than the slowOpThresholdMs to the server log even when the database profiler is not active.

参见

Additional documentation regarding Database Profiling.

参见

db.getProfilingStatus()” and “db.setProfilingLevel()” provide wrappers around this functionality in the mongo shell.

注解

This command obtains a write lock on the affected database and will block other operations until it has completed. However, the write lock is only held while enabling or disabling the profiler. This is typically a short operation.

←   ping validate  →
ON THIS PAGE