Navigation

Profile Databases

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.

Considerations

Important

Please read the following considerations before you enable profiling.

Security

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.

system.profile Collection

The MongoDB profiler stores data in the 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 collection, such as Monitoring queries of the system.profile collection.

Resource Consumption Impact

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

Data Collection

Every minute, the agent queries the 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.

Data Display

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

Time to Propagate Changes to the MongoDB Agent

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.

Rolling Restart of mongod Processes

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.

Enable Profiling

To enable profiling:

  1. Click Deployment, the Processes tab, and then the Topology view.
  2. On the line listing the process, click Metrics.
  3. Click the Profiler tab above the charts.
  4. Toggle Profiling to On.

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

Profiler Interface

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

Profiling Chart

Set Chart Filters

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

Change Slow Operations Threshold

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.

Request Index Suggestions

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.

Profiling Table

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