-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-26726] Synchronize the amount of memory used by the broadcast variable to the UI display #23649
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
Conversation
…not synchronized to the UI display
| } | ||
| } | ||
|
|
||
| def updateBroadcastBlock(event: SparkListenerBlockUpdated, broadcast: BroadcastBlockId): Unit = { |
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.
def -> private def?
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.
Thank you for your review! I have submitted a new change.
|
Hi, @httfighter . |
|
It's not really a UI PR. But it does need a unit test. |
|
@vanzin Thank you for your review! I have added the test case. |
|
@dongjoon-hyun Memory usage for the broadcast variable will not be updated synchronously in the UI before modification. After the modification, the memory usage for the broadcast variable will be updated synchronously in the UI. |
vanzin
left a comment
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.
Please use the PR title/description to explain the fix, not the problem.
| } | ||
| } | ||
|
|
||
| private def updateBroadcastBlock(event: SparkListenerBlockUpdated, |
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.
multi line args start on the next line.
| val memoryDelta = event.blockUpdatedInfo.memSize * (if (storageLevel.useMemory) 1 else -1) | ||
|
|
||
| // Function to apply a delta to a value, but ensure that it doesn't go negative. | ||
| def newValue(old: Long, delta: Long): Long = math.max(0, old + delta) |
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.
Already exists (addDeltaToValue).
|
|
||
| val maybeExec = liveExecutors.get(executorId) | ||
| maybeExec.foreach { exec => | ||
| if (exec.hasMemoryInfo) { |
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 block exists in a very similar form in two other places. Feels like time to have a helper method.
|
@vanzin Thanks for your advice. I have updated the code. |
vanzin
left a comment
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.
Your PR title still explains the problem, not the fix.
|
|
||
| } | ||
|
|
||
| // update executor memory and disk usage info |
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 just repeats the method name. Remove.
| storageLevel: StorageLevel, | ||
| memoryDelta: Long, | ||
| diskDelta: Long, | ||
| OffHeapDelta: Option[Long], |
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.
Variable names start with lower case.
I'd also avoid the Option here. That causes extra allocations + boxing which this code should avoid.
In the broadcast update you could just repeat memoryDelta as the parameter, since that's what this boils down to...
| diskDelta: Long, | ||
| OffHeapDelta: Option[Long], | ||
| OnHeapDelta: Option[Long]): Unit = { | ||
| maybeExec.foreach { exec => |
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.
Move the foreach to the caller. That avoids repeating the foreach, and you could wrap more logic that doesn't need to run when the executor is not found.
|
@vanzin OK. Please help me review it again. |
|
ok to test |
vanzin
left a comment
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.
Looks good pending tests.
| val diskDelta = event.blockUpdatedInfo.diskSize * (if (storageLevel.useDisk) 1 else -1) | ||
| val memoryDelta = event.blockUpdatedInfo.memSize * (if (storageLevel.useMemory) 1 else -1) | ||
|
|
||
| liveExecutors.get(executorId).foreach { exec => |
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.
All the code above can be moved within the foreach.
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.
@vanzin Yes! It is true. I have updated the code.
|
Test build #101904 has finished for PR 23649 at commit
|
|
Test build #101925 has finished for PR 23649 at commit
|
|
Merging to master / 2.4. |
…variable to the UI display …not synchronized to the UI display ## What changes were proposed in this pull request? The amount of memory used by the broadcast variable is not synchronized to the UI display. I added the case for BroadcastBlockId and updated the memory usage. ## How was this patch tested? We can test this patch with unit tests. Closes #23649 from httfighter/SPARK-26726. Lead-authored-by: 韩田田00222924 <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: Marcelo Vanzin <[email protected]> (cherry picked from commit f4a17e9) Signed-off-by: Marcelo Vanzin <[email protected]>
…variable to the UI display …not synchronized to the UI display ## What changes were proposed in this pull request? The amount of memory used by the broadcast variable is not synchronized to the UI display. I added the case for BroadcastBlockId and updated the memory usage. ## How was this patch tested? We can test this patch with unit tests. Closes #23649 from httfighter/SPARK-26726. Lead-authored-by: 韩田田00222924 <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: Marcelo Vanzin <[email protected]> (cherry picked from commit f4a17e9) Signed-off-by: Marcelo Vanzin <[email protected]>
|
It was a clean backport to 2.3 and passed tests, so also merged to 2.3. |
|
It's great! And, cc @maropu . |
…variable to the UI display …not synchronized to the UI display ## What changes were proposed in this pull request? The amount of memory used by the broadcast variable is not synchronized to the UI display. I added the case for BroadcastBlockId and updated the memory usage. ## How was this patch tested? We can test this patch with unit tests. Closes apache#23649 from httfighter/SPARK-26726. Lead-authored-by: 韩田田00222924 <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: Marcelo Vanzin <[email protected]>
…variable to the UI display …not synchronized to the UI display ## What changes were proposed in this pull request? The amount of memory used by the broadcast variable is not synchronized to the UI display. I added the case for BroadcastBlockId and updated the memory usage. ## How was this patch tested? We can test this patch with unit tests. Closes apache#23649 from httfighter/SPARK-26726. Lead-authored-by: 韩田田00222924 <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: Marcelo Vanzin <[email protected]> (cherry picked from commit f4a17e9) Signed-off-by: Marcelo Vanzin <[email protected]>
…variable to the UI display …not synchronized to the UI display ## What changes were proposed in this pull request? The amount of memory used by the broadcast variable is not synchronized to the UI display. I added the case for BroadcastBlockId and updated the memory usage. ## How was this patch tested? We can test this patch with unit tests. Closes apache#23649 from httfighter/SPARK-26726. Lead-authored-by: 韩田田00222924 <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: Marcelo Vanzin <[email protected]> (cherry picked from commit f4a17e9) Signed-off-by: Marcelo Vanzin <[email protected]>
…variable to the UI display …not synchronized to the UI display ## What changes were proposed in this pull request? The amount of memory used by the broadcast variable is not synchronized to the UI display. I added the case for BroadcastBlockId and updated the memory usage. ## How was this patch tested? We can test this patch with unit tests. Closes apache#23649 from httfighter/SPARK-26726. Lead-authored-by: 韩田田00222924 <[email protected]> Co-authored-by: [email protected] <[email protected]> Signed-off-by: Marcelo Vanzin <[email protected]> (cherry picked from commit f4a17e9) Signed-off-by: Marcelo Vanzin <[email protected]>


…not synchronized to the UI display
What changes were proposed in this pull request?
The amount of memory used by the broadcast variable is not synchronized to the UI display.
I added the case for BroadcastBlockId and updated the memory usage.
How was this patch tested?
We can test this patch with unit tests.