-
Notifications
You must be signed in to change notification settings - Fork 29.2k
[SPARK-48628][CORE] Add task peak on/off heap memory metrics #47192
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
Changes from all commits
2c59644
672d058
89a703f
70bbdc5
12a849b
dad880f
8cec467
163fe06
110ccae
07c2713
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,8 @@ class TaskMetrics private[spark] () extends Serializable { | |
| private val _memoryBytesSpilled = new LongAccumulator | ||
| private val _diskBytesSpilled = new LongAccumulator | ||
| private val _peakExecutionMemory = new LongAccumulator | ||
| private val _peakOnHeapExecutionMemory = new LongAccumulator | ||
| private val _peakOffHeapExecutionMemory = new LongAccumulator | ||
| private val _updatedBlockStatuses = new CollectionAccumulator[(BlockId, BlockStatus)] | ||
|
|
||
| /** | ||
|
|
@@ -111,9 +113,22 @@ class TaskMetrics private[spark] () extends Serializable { | |
| * joins. The value of this accumulator should be approximately the sum of the peak sizes | ||
| * across all such data structures created in this task. For SQL jobs, this only tracks all | ||
| * unsafe operators and ExternalSort. | ||
| * This is not equal to peakOnHeapExecutionMemory + peakOffHeapExecutionMemory | ||
| */ | ||
| // TODO: SPARK-48789: the naming is confusing since this does not really reflect the whole | ||
|
liuzqt marked this conversation as resolved.
|
||
| // execution memory. We'd better deprecate this once we have a replacement. | ||
| def peakExecutionMemory: Long = _peakExecutionMemory.sum | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about we change its implementation to be
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I think we can plan this breaking change at spark 4.0
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. peakOnHeapExecutionMemory, peakOffHeapExecutionMemory can peak at different times, so we can't replace it with the sum.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see, makes sense. Let's leave it then. |
||
|
|
||
| /** | ||
| * Peak on heap execution memory as tracked by TaskMemoryManager. | ||
| */ | ||
| def peakOnHeapExecutionMemory: Long = _peakOnHeapExecutionMemory.sum | ||
|
|
||
| /** | ||
| * Peak off heap execution memory as tracked by TaskMemoryManager. | ||
| */ | ||
| def peakOffHeapExecutionMemory: Long = _peakOffHeapExecutionMemory.sum | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Discuss: I am trying to reason about completeness of these metrics (given we want to eventually deprecate the existing one).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. peakExecutionMemory <= peakOnHeapExecutionMemory + peakOffHeapExecutionMemory? I think yes, because Instead, the legacy
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1, I agree that the If we trace through the existing callers of |
||
|
|
||
| /** | ||
| * Storage statuses of any blocks that have been updated as a result of this task. | ||
| * | ||
|
|
@@ -141,6 +156,10 @@ class TaskMetrics private[spark] () extends Serializable { | |
| private[spark] def setResultSerializationTime(v: Long): Unit = | ||
| _resultSerializationTime.setValue(v) | ||
| private[spark] def setPeakExecutionMemory(v: Long): Unit = _peakExecutionMemory.setValue(v) | ||
| private[spark] def setPeakOnHeapExecutionMemory(v: Long): Unit = | ||
| _peakOnHeapExecutionMemory.setValue(v) | ||
| private[spark] def setPeakOffHeapExecutionMemory(v: Long): Unit = | ||
| _peakOffHeapExecutionMemory.setValue(v) | ||
| private[spark] def incMemoryBytesSpilled(v: Long): Unit = _memoryBytesSpilled.add(v) | ||
| private[spark] def incDiskBytesSpilled(v: Long): Unit = _diskBytesSpilled.add(v) | ||
| private[spark] def incPeakExecutionMemory(v: Long): Unit = _peakExecutionMemory.add(v) | ||
|
|
@@ -227,6 +246,8 @@ class TaskMetrics private[spark] () extends Serializable { | |
| MEMORY_BYTES_SPILLED -> _memoryBytesSpilled, | ||
| DISK_BYTES_SPILLED -> _diskBytesSpilled, | ||
| PEAK_EXECUTION_MEMORY -> _peakExecutionMemory, | ||
| PEAK_ON_HEAP_EXECUTION_MEMORY -> _peakOnHeapExecutionMemory, | ||
| PEAK_OFF_HEAP_EXECUTION_MEMORY -> _peakOffHeapExecutionMemory, | ||
| UPDATED_BLOCK_STATUSES -> _updatedBlockStatuses, | ||
| shuffleRead.REMOTE_BLOCKS_FETCHED -> shuffleReadMetrics._remoteBlocksFetched, | ||
| shuffleRead.LOCAL_BLOCKS_FETCHED -> shuffleReadMetrics._localBlocksFetched, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.