Viewing Job Performance Metrics
Query Profile provides detailed quantitative records about how a Spark SQL job runs. It shows the performance of each phase, from parsing and compilation to execution, including the execution plan, the execution time and number of processed rows of each operator, node memory usage, the relationships between execution steps, and task health status. With the directed acyclic graph (DAG) and metric data, you can see which operators run, how long each operator takes, how much data it processes, and how much memory it uses. This helps you find performance bottlenecks.
We recommend that you view job performance metrics in the following scenarios:
- If SQL execution is slow, find the node that takes the most time and check whether the bottleneck is in the scan, join, aggregation, or shuffle phase.
- If memory usage or the amount of computation is abnormal, check the peak memory and the number of processed rows of each operator to see whether resources are used properly.
- If a job fails, find the failed node based on the execution plan and the error message.
- After you modify SQL statements or adjust parameters, compare the execution plans and the time each node takes before and after the change to verify the effect of the optimization.
AI DataLake provides performance metrics at three levels:
| Level | Metric | Description |
|---|---|---|
| Querying basic information | query | Overall job information, including the query status, execution time, submitting user, and error message. |
| Querying performance statistics | query.metrics | Overall time statistics, including the total time, compilation and execution time, and the time spent on metadata and file operations. |
| Execution plan graph | graphs | DAG of the physical execution plan, including the operator nodes, the dependencies between them, and the key metrics of each operator (number of processed rows, time spent, and peak memory). |
Notes and Constraints
You can view performance metrics for all executed SparkSQL jobs.
Procedure
- Log in to the AI DataLake console.
- Go to the page for viewing the performance metrics of a SparkSQL job.
- Via the Job Run History page
- Choose Job Development > Job Run History, click the Spark tab, and then select SparkSQL for the endpoint type.
- Locate the target job, click More in the Operation column, and select Query Profile.
- Via the engine endpoint page
- Choose Engine Endpoints > Spark.
- Select Type as the filter in the search box and select SparkSQL.
- Click the name of the target endpoint.
- On the Job Run History tab, click More in the Operation column of the target job, and then select Query Profile.
- Via the Job Run History page
- View the metric information in either of the following ways: For details about the metric fields, see Metric Description.
- Click the target node and view the metric data on the right.
By visualizing the query profile file, you can analyze the performance bottlenecks during SQL query execution by checking the execution time of each physical operator, number of processed rows, and memory consumption. The visualized DAG clearly shows the slowest part of SQL queries and helps evaluate the impact of SQL modifications.
- Click Download in the lower right corner of the page and view the data in the query profile file.
- Click the target node and view the metric data on the right.
Metric Description
- query: Querying basic information
Records basic information about a query job, including the submitter, execution time, and final status.
Table 1 Description of query metrics Metric Field
Description
query.id
The unique ID of a query.
query.status
The status of a query. The value can be RUNNING, FINISHED, or FAILED.
query.queryText
The SQL query text.
query.queryStartTimeMs
The start timestamp of a query, in milliseconds.
query.queryEndTimeMs
The end timestamp of a query, in milliseconds.
query.user
Information about the user who submits the query.
query.executedAsUser
Information about the user who executes the query.
query.errorMessage
The error information reported when the query fails.
query.isFinal
Whether the query is complete (final status).
query.metrics
Query-level metric data.
query.statementType
The SQL statement type.
query.user.id
The user ID.
query.user.name
The username.
query.executedAsUser.id
The ID of the user who executes the query.
query.executedAsUser.name
The name of the user who executes the query.
- query.metrics: Querying performance statistics
Records overall query performance statistics, including the total time, compilation and execution time, and the time spent on metadata operations, file list retrieval, compilation phases, and optimization rules. You can use these statistics to find out which phase (compilation, metadata, or execution) takes the most time.
Table 2 Description of query.metrics metrics Metric Field
Description
query.metrics.totalTimeMs
The total query duration, in milliseconds.
query.metrics.compilationTimeMs
Total compilation time (in milliseconds) = Sum of durationMs of each phase.
query.metrics.executionTimeMs
Execution duration, in milliseconds = totalTimeMs – compilationTimeMs.
query.metrics.metadataTimeMs
The total metadata operation duration, in milliseconds.
query.metrics.metadataOperationInfo
A list showing the metadata operation details.
query.metrics.fileListTimeMs
The total time for obtaining the file list, in milliseconds.
query.metrics.fileListInfo
Details about obtaining the file list.
query.metrics.liquidClusteringMetrics
Liquid Clustering metrics (join key usage statistics).
query.metrics.phases
Information about each compilation phase in a query.
query.metrics.rules
Top 10 optimization rules that are the most time-consuming.
query.metrics.metadataOperationInfo[*].operationName
The name of the metadata operation.
query.metrics.metadataOperationInfo[*].callTimes
The number of calls.
query.metrics.metadataOperationInfo[*].minTime
The minimum duration, in milliseconds.
query.metrics.metadataOperationInfo[*].medTime
The median duration, in milliseconds.
query.metrics.metadataOperationInfo[*].maxTime
The maximum duration, in milliseconds.
query.metrics.fileListInfo[*].rootPathSize
The size of the root path.
query.metrics.fileListInfo[*].outputSize
The output size.
query.metrics.fileListInfo[*].fileListTime
The time required for obtaining the file list.
query.metrics.liquidClusteringMetrics[*].tableQualifiedName
The fully qualified table name.
query.metrics.liquidClusteringMetrics[*].joinMetrics[*].key
The name of the join key column.
query.metrics.liquidClusteringMetrics[*].joinMetrics[*].usageCounter
The number of times the join key is used.
query.metrics.phases[*].phaseName
The phase name, which can be parsing, analysis, optimization, or planning.
query.metrics.phases[*].startTimeMs
The start time of the phase, in milliseconds.
query.metrics.phases[*].endTimeMs
The end time of the phase, in milliseconds.
query.metrics.phases[*].durationMs
The duration of the phase, in milliseconds.
query.metrics.rules[*].ruleName
The name of the optimization rule.
query.metrics.rules[*].totalTimeNs
The total time consumed by the rule, in nanoseconds.
query.metrics.rules[*].numInvocations
The total number of rule calls.
query.metrics.rules[*].numEffectiveInvocations
The number of valid rule calls.
- graphs: Execution plan graph
Uses a DAG to record the complete structure of the physical execution plan, including nodes (operators), the dependencies between nodes (edges), stage information, and the key metrics of each node (number of processed rows, time spent, and peak memory). This is the core level for finding performance bottlenecks. By comparing the time spent and the number of processed rows of each node, you can quickly find the slowest operator.
Table 3 Description of graphs metrics Metric Field
Description
graphs[*].nodes
A list of nodes in the execution plan.
graphs[*].edges
A list of edges in the execution plan.
graphs[*].stageData
The stage-level data.
graphs[*].executionId
The execution ID.
graphs[*].timeSubmittedMs
The submission timestamp, in milliseconds.
graphs[*].timeCompletedMs
The completion timestamp, in milliseconds.
graphs[*].displayInfo
The summary display information.
graphs[*].nodes[*].id
The node ID.
graphs[*].nodes[*].name
The node name, for example, Scan parquet and HashAggregate.
graphs[*].nodes[*].tag
The node tag.
graphs[*].nodes[*].metadata
The node metadata.
graphs[*].nodes[*].metrics
A list of node metrics.
graphs[*].nodes[*].keyMetrics
Key metrics, such as Rows, Time Spent, and Memory Peaks.
graphs[*].nodes[*].hidden
Whether it is hidden on the UI.
graphs[*].nodes[*].stageLinks
A list of associated stage IDs.
graphs[*].nodes[*].subgraphParent
The parent node ID of the subgraph.
graphs[*].nodes[*].keyMetrics.rowsNum
The number of output rows.
graphs[*].nodes[*].keyMetrics.durationMs
The time spent, in milliseconds.
graphs[*].nodes[*].keyMetrics.peakMemoryBytes
The peak memory, in bytes.
graphs[*].nodes[*].metrics[*].label
The display name of the metric.
graphs[*].nodes[*].metrics[*].key
The metric key.
graphs[*].nodes[*].metrics[*].metricType
The metric type, which can be SIZE_METRIC_BYTES, TIMING_METRIC_NS, TIMING_METRIC_MS, AVERAGE_METRIC, SUM_METRIC, or UNKNOWN_TYPE.
graphs[*].nodes[*].metrics[*].value
The metric value, which is converted to Long.
graphs[*].nodes[*].metrics[*].hidden
Whether it is hidden
graphs[*].nodes[*].metadata[*].key
The metadata key, which can be OUTPUT, GROUPING_EXPRESSIONS, AGGREGATE_EXPRESSIONS, PARTITIONING_TYPE, SHUFFLE_ATTRIBUTES, SCAN_DATABASE, SCAN_TABLE, or SCAN_IDENTIFIER.
graphs[*].nodes[*].metadata[*].label
The metadata label.
graphs[*].nodes[*].metadata[*].value
The metadata value.
graphs[*].nodes[*].metadata[*].values
A list of metadata values.
graphs[*].nodes[*].metadata[*].metaValues[*].value
The metadata subitem value.
graphs[*].edges[*].fromId
The ID of the start node.
graphs[*].edges[*].toId
The ID of the target node.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot