Docs Menu

Docs HomeMongoDB Cloud Manager

Profile Databases

On this page

  • Considerations
  • Enable Profiling
  • Profiler Interface


Available only with Cloud Manager Premium

This feature is available only with Cloud Manager Premium, which comes with certain MongoDB subscriptions. To learn more about Cloud Manager Premium, Contact MongoDB.

A database profiler gathers statistics about writes, cursors, and commands on one running mongod instance.

Cloud Manager can collect and display statistics from any of your mongod instances that have profiling enabled. Cloud Manager displays this data in the Profiler section of an instance's Metrics page. To access an instance's metrics, click the Metrics button for that instance.

The Profiler displays one aspect, like Operation Execution Time, that could slow database operations over a set time frame. It displays this data in both a chart and a table that each can filter on aspect and time frame. The Profiler suggests indexes for your databases to improve the performance of slow operations.


Please read the following considerations before you enable profiling.

Profile data may include sensitive information including the content of database queries. Ensure that exposing this data to Cloud Manager is consistent with your information security practices.

The MongoDB profiler stores data in the system.profile <<database>.system.profile> collection. Cloud Manager caps this collection to 1 MB as a default. You may increase the size of this collection up to 4 MB.

When collecting data from the profiler, Cloud Manager ignores operations on the system.profile <<database>.system.profile> collection, such as Monitoring queries of the system.profile <<database>.system.profile> collection.

The profiler consumes resources which may slow MongoDB performance. Consider the resource impact before enabling profiling.

Every minute, the agent queries the system.profile <<database>.system.profile> collection for the last 20 documents created. Monitoring sends those documents to Cloud Manager.


See also:

Database Profiler in the MongoDB Manual.

Cloud Manager samples profile documents until it samples either all documents returned or 4 MB of returned document data. This 4 MB limit may be reached if you increase the collection's size to 4 MB and your database creates large profiler documents.

Monitoring tries to minimize its effect on the monitored systems. If polling profile data slows database performance, Cloud Manager throttles how often it collects data.

Cloud Manager displays no more than 10,000 data points in the Profiler charts.

With profiling enabled, configuration changes made in Cloud Manager can take up to 2 minutes to propagate to the agent and 1 more minute before profiling data appears in the Cloud Manager interface.

Cloud Manager performs a rolling restart of the mongod processes in your cluster when you enable or disable database profiling. If your cluster is a replica set, a replica set election occurs as a byproduct of the restart. This one-time operation is in addition to the time required to propogate configuration changes to the Automation.

To enable profiling:

  1. Click Deployment, the Processes tab, and then the Topology view.

  2. On the line listing the process for which you want to enable profiling, click Metrics.

  3. Click the Profiler tab above the charts.

  4. Toggle Profiling to On.

Once you enable profiling, your mongod instance collects profile data for operations longer than the slow operation threshold and reports them to Cloud Manager. The threshold for slow operations applies to the entire mongod instance. Cloud Manager defaults this threshold to 100 ms.

The Profiler has two sections to the page that display database profile information: a chart and a table. Each can display different data.

Above the chart, select the metric and time period you want to see.

  1. Select the metric from the Display menu. Accepted options are:

    • Operation Execution Time (default)

    • Keys Examined

    • Docs Returned

    • Examined:Returned Ratio

    • Num Yields

    • Response Length

  2. Select the time period from the View Last menu. Accepted options are:

    • 24 hr (default)

    • 12 hr

    • 6 hr

    • 1 hr

    • 15 min

To change the slow operations threshold:

  1. Click the Milliseconds button to the right of the For Operations Longer Than label to open the Specify the Threshold for Slow Operations modal.

  2. Change the Set the Threshold for Slow Operations to your desired number of milliseconds.

  3. Click Apply if you want to change the threshold. Click Cancel to close the modal without changing the threshold.

When you change the threshold, you change it for all databases on the instance.

Based on the Profiler data, you may want to improve the performance of slow queries.

  1. Click Calculate Suggested Indexes to direct Cloud Manager to analyze your databases.

  2. After the analysis completes, the Suggested Indexes for Improving Query Performance modal displays.

    This modal offers suggested indexes with the appropriate database commands to created those indexes.

  3. After you have finished using the suggested indexes, click OK to close the modal.

Above the table, select the namespace, operation type, and metric you wish to profile:

  1. Click All Namespaces to change which combination of databases and collections to profile.

  2. Click All Operations to change which operations you want to profile.

  3. Click Operation Execution Time to change which metric you want to profile. Accepted options are:

    • Operation Execution Time (default)

    • Keys Examined

    • Docs Returned

    • Examined:Returned Ratio

    • Num Yields

    • Response Length

← Monitor Collection-Level Query Latency