Uh oh!
There was an error while loading. Please reload this page.
[SPARK-4452][Core]Shuffle data structures can starve others on the same thread for memory - #10024
[SPARK-4452][Core]Shuffle data structures can starve others on the same thread for memory#10024lianhuiwang wants to merge 21 commits into
Conversation
SparkQA
commented
Nov 28, 2015
Test build #46839 has finished for PR 10024 at commit
|
lianhuiwang
commented
Nov 29, 2015
test this please |
SparkQA
commented
Nov 29, 2015
Test build #46852 has finished for PR 10024 at commit
|
SparkQA
commented
Jan 24, 2016
Test build #49948 has finished for PR 10024 at commit
|
SparkQA
commented
Jan 24, 2016
Test build #49951 has finished for PR 10024 at commit
|
Hi @lianhuiwang thanks for submitting this patch. I just have a high-level question first. If I understand how this works correctly, the idea is that:
Is this a correct understanding? If so, this seems to hinge on one key assumption: that the I think this assumption is sound -- it is implied by "destructive"SortedIterator in the internals, though I think the actual wrapping FWIW, I started down the path of writing something similar with_out_ that assumption -- when a spill was requested on an in-flight iterator, then the entire in-memory structure would get spilled to disk, and the in-flight iterator would switch to the spilled data, and advance to the same location in the spilled data that it was on the in-memory data. This was pretty convoluted, and as I started writing tests I realized there were corner cases that needed work. So I decided to submit the simpler change instead. It seems much easier to do it your way. I do have some test which I think I can add as well -- lemme dig those up and send them later today. |
| /** | ||
| * Allocates a heap memory of `size`. | ||
| */ | ||
| public long allocateHeapExecutionMemory(long size) { |
There was a problem hiding this comment.
This function does not actually create any object, I'd like to call it acquireOnHeapMemory
davies
commented
Apr 18, 2016
@lianhuiwang Thanks for working on this, I think it's in the good direction. Two things left:
|
SparkQA
commented
Apr 18, 2016
Test build #56099 has finished for PR 10024 at commit
|
lianhuiwang
commented
Apr 19, 2016
@davies Thanks. I have added a SpillableIterator that can make consumer and spill thread safe. I think you can take a look at it. |
SparkQA
commented
Apr 19, 2016
Test build #56229 has finished for PR 10024 at commit
|
@squito Yes, I think your understanding is correct. this PR only support that a Spillables's iterator will be called once. The code 'val sort = new Spillable() sort.iterator() sort.iterator()' will be wrong. |
SparkQA
commented
Apr 19, 2016
Test build #56246 has finished for PR 10024 at commit
|
SparkQA
commented
Apr 20, 2016
Test build #56365 has finished for PR 10024 at commit
|
lianhuiwang
commented
Apr 21, 2016
@davies Yes, I have update it using object.lock. I will rebased to master. |
SparkQA
commented
Apr 21, 2016
Test build #56465 has finished for PR 10024 at commit
|
lianhuiwang
commented
Apr 21, 2016
test it please. |
lianhuiwang
commented
Apr 21, 2016
Jenkins, test this please |
SparkQA
commented
Apr 21, 2016
Test build #56456 has finished for PR 10024 at commit
|
SparkQA
commented
Apr 21, 2016
Test build #56459 has finished for PR 10024 at commit
|
SparkQA
commented
Apr 21, 2016
Test build #56462 has finished for PR 10024 at commit
|
SparkQA
commented
Apr 21, 2016
Test build #56466 has finished for PR 10024 at commit
|
lianhuiwang
commented
Apr 21, 2016
@davies Now all tests have been passed. So Could you take a look again? Thanks. |
SparkQA
commented
Apr 21, 2016
Test build #56475 has finished for PR 10024 at commit
|
| _elementsRead = 0 | ||
| val freeMemory = myMemoryThreshold - initialMemoryThreshold | ||
| _memoryBytesSpilled += freeMemory | ||
| releaseMemory() |
There was a problem hiding this comment.
We should free memory first, then release memory
There was a problem hiding this comment.
It did collection = null in forceSpill() before releaseMemory().
davies
commented
Apr 21, 2016
LGTM |
davies
commented
Apr 21, 2016
@lianhuiwang Have you run some stress tests with latest change? |
davies
commented
Apr 21, 2016
This is a big change, maybe not. |
zzcclp
commented
Apr 21, 2016
sorry, I mistakenly deleted my comment. |
@davies I also have run unit tests with big number N. |
SparkQA
commented
Apr 21, 2016
Test build #56496 has finished for PR 10024 at commit
|
lianhuiwang
commented
Apr 21, 2016
Jenkins, test this please |
SparkQA
commented
Apr 21, 2016
Test build #56513 has finished for PR 10024 at commit
|
SparkQA
commented
Apr 21, 2016
Test build #56532 has finished for PR 10024 at commit
|
davies
commented
Apr 21, 2016
Merging this into master, thanks! |
lianhuiwang
commented
Apr 22, 2016
@davies Thanks. |
…he same thread for memory apache#10024 [SPARK-14007] [SQL] Manage the memory used by hash map in shuffled hash join (just TaskMemoryManager.java) [SPARK-13113] [CORE] Remove unnecessary bit operation when decoding page number
…same thread for memory In apache#9241 It implemented a mechanism to call spill() on those SQL operators that support spilling if there is not enough memory for execution. But ExternalSorter and AppendOnlyMap in Spark core are not worked. So this PR make them benefit from apache#9241. Now when there is not enough memory for execution, it can get memory by spilling ExternalSorter and AppendOnlyMap in Spark core. add two unit tests for it. Author: Lianhui Wang <lianhuiwang09@gmail.com> Closesapache#10024 from lianhuiwang/SPARK-4452-2.
What changes were proposed in this pull request?
In #9241 It implemented a mechanism to call spill() on those SQL operators that support spilling if there is not enough memory for execution.
But ExternalSorter and AppendOnlyMap in Spark core are not worked. So this PR make them benefit from #9241. Now when there is not enough memory for execution, it can get memory by spilling ExternalSorter and AppendOnlyMap in Spark core.
How was this patch tested?
add two unit tests for it.