-
Notifications
You must be signed in to change notification settings - Fork 338
feat: Add additional metrics for shuffle write #1173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 7 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ff12c69
show shuffle wall time
andygrove 0034bc0
use write_time consistently
andygrove 4ec6ed6
record native shuffle elapsed compute
andygrove 565c27a
save progress
andygrove d3f00bf
input_time
andygrove cfc72f5
save
andygrove b26322e
Ready for review
andygrove 3c8f3cf
add IPC time
andygrove 0c85460
address feedback
andygrove a317fc5
update benchmark code
andygrove 73b4f9b
add input_batches metric
andygrove bf039f7
address feedback
andygrove File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| <!--- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
|
|
||
| # Comet Metrics | ||
|
|
||
| ## Spark SQL Metrics | ||
|
|
||
| Set `spark.comet.metrics.detailed=true` to see all available Comet metrics. | ||
|
|
||
| ### CometScanExec | ||
|
|
||
| `CometScanExec` uses nanoseconds for total scan time. Spark also measures scan time in nanoseconds but converts to | ||
| milliseconds _per batch_ which can result in a large loss of precision, making it difficult to compare scan times | ||
| between Spark and Comet. | ||
|
|
||
| ### Exchange | ||
|
|
||
| Comet adds some additional metrics: | ||
|
|
||
| | Metric | Description | | ||
| | ------------------------------- | ----------------------------------------------------------------------------------------- | | ||
| | `native shuffle time` | Total time spent in native shuffle writer, excluding the execution time of the input plan | | ||
| | `native shuffle input time` | Time spend executing the shuffle input plan and fetching batches. | | ||
| | `shuffle wall time (inclusive)` | Total time executing the shuffle write, inclusive of executing the input plan. | | ||
|
|
||
| ## Native Metrics | ||
|
|
||
| Setting `spark.comet.explain.native.enabled=true` will cause native plans to be logged in each executor. Metrics are | ||
| logged for each native plan (and there is one plan per task, so this is very verbose). | ||
|
|
||
| Here is a guide to some of the native metrics. | ||
|
|
||
| ### ScanExec | ||
|
|
||
| | Metric | Description | | ||
| | ----------------- | --------------------------------------------------------------------------------------------------- | | ||
| | `elapsed_compute` | Total time spent in this operator, fetching batches from a JVM iterator. | | ||
| | `jvm_fetch_time` | Time spent in the JVM fetching input batches to be read by this `ScanExec` instance. | | ||
| | `arrow_ffi_time` | Time spent using Arrow FFI to create Arrow batches from the memory addresses returned from the JVM. | | ||
|
|
||
| ### ShuffleWriterExec | ||
|
|
||
| | Metric | Description | | ||
| | ----------------- | ----------------------------------------------------- | | ||
| | `elapsed_compute` | Total time excluding any child operators. | | ||
| | `input_time` | Time spent executing input plan and fetching batches. | | ||
| | `write_time` | Time spent writing bytes to disk. | | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like a problem statement. Did you mean that
spark.comet.metrics.detailed=truewill not loose the precision?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afaik, the conversion happens only when the data is to be displayed in the UI. (https://github.com/apache/spark/blob/576caec1da85c4451fe63e2a5923f2dbf136e278/sql/core/src/main/scala/org/apache/spark/sql/execution/metric/SQLMetrics.scala#L248)
But this is what Spark does with all its nanosecond timing metrics, so we aren't doing anything different here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I have updated this
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spark converts nanos to millis on each batch:
We just use the nano time:
It actually makes a large difference to the time reported in some cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the description in the metrics guide to explain this in more detail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. That could be a big difference in small datasets (wonder if the same occurs when we have large files). Either way, better to not lose precision. We are not likely to run into overflow issues are we?