Identifying and analyzing slow queries is essential to the smooth running of your application. With the new Query Profiler in Atlas, the entire process can be performed from the Atlas UI, with no manual log parsing or third-party tools needed.
Identifying Slow Queries without Parsing Logs
Until now, one of the most popular ways to analyze slow queries in Atlas was to download server logs and use third-party tools to parse and analyze the data. This process is often time-consuming and involves deep knowledge of MongoDB processes to make sense of the information.
The Query Profiler eliminates the need to extract, parse, and visualize logs by displaying slow-running queries in a single, interactive dashboard in the Atlas UI. The Query Profiler is a premium feature for dedicated clusters therefore you'll need an M10 or higher cluster to access it.
You can find the Query Profiler in the cluster's view, along with the Real Time view and the Performance Advisor. A chart provides a high-level view of that information that makes it easy to quickly identify outliers and general trends, while a table offers operation statistics by namespace (database and collection) and operation type. By default, a slow operation for the Query Profiler is one that crosses a 100ms threshold.
Both the chart and table can be customized using the options across the top of the chart. You can choose which metric to filter and list operations. This includes operation execution time, scanned to returned ratio, whether an index was used, whether an in-memory sort occurred, and more. You can also select a specific time frame for operations displayed, from the past 15 minutes to the past 24 hours.
See Key Performance Statistics on Database Operations
Once you have identified which operations are potentially problematic, the Query Profiler allows you to dig deeper into operation-level statistics to gain more insight into what’s happening.
You can navigate to the operation details page in the Query Profiler by selecting a point on the chart or by selecting a row on the table. Both will take you to a list view of all operations with the same namespace and operation type.
If a specific operation is highlighted, the system will display additional information such as the request made to the server, index usage and size of response from the server.
This view provides granular information on a specific operation in the context of similar operations, which can help you identify what optimizations need to be made to improve performance.
The Query Profiler is a new, Atlas-only option for analyzing performance. Users are still able to analyze their logs or use the MongoDB Database Profiler to identify their performance issues. We are confident that for most users the Query Profiler will provide them all the analysis and insight that they need, without sacrificing time or performance to get it.
You can find out more about the Query Profiler in the Atlas Documentation.