Performance diagnostics in Managed Service for MongoDB
Managed Service for MongoDB provides a built-in tool for DBMS cluster performance diagnostics. Use it to analyze MongoDB profiling and index metrics.
Warning
This feature is at the Preview stage.
Enabling statistics collection
To use the diagnostics tool, enable statistics collection when creating a cluster or updating its settings. By default, statistics are only collected for queries longer than 300 ms. If required, in DBMS settings, change the time threshold for collecting slow query statistics in the slowOpThreshold
parameter.
Getting profiling data
For read/write and some other DB queries (such as aggregate
), you can view the data collected by the MongoDB profiler:
- A chart with metrics for the selected data segment. You can hide or show individual categories in the chart by clicking on the category name in the chart legend.
- Table with statistics by query type.
To get data:
-
Go to the folder page
and select Managed Service for MongoDB. -
Click the cluster name and select the Performance diagnostics → Profiling tab.
-
Specify the time interval and, if necessary, set filters.
-
Select:
- Data segment:
FORM
: By query typeHOSTNAME
: By shard PRIMARY hostNAMESPACE
: By collection nameSHARD
: By shardUSER
: By user
- Data grouping parameter:
COUNT
: Number of queries.DOCUMENTS_EXAMINED
: Number of the collection documents scanned when executing the query.DOCUMENTS_RETURNED
: Number of returned documents.DURATION
: Query execution duration.KEYS_EXAMINED
: Number of index keys scanned when executing the query.RESPONSE_LENGTH
: Size of the document returned as a result of the query.
- Aggregation function of the selected parameter:
AVG
: Average valueSUM
: Sum
- Data segment:
For more information about what statistics you can get, see the MongoDB documentation
Getting information about indexes
You can get collection access statistics for queries and recommendations for creating indexes of certain fields to speed up query processing.
- Go to the folder page
and select Managed Service for MongoDB. - Click the cluster name and select the Performance diagnostics → Suggested indexes tab.
- Specify the time interval and, if necessary, set filters.
The table shows the fields to create indexes for and the number of times the collections were queried.