Uh oh!
There was an error while loading. Please reload this page.
[SPARK-21595] Separate thresholds for buffering and spilling in ExternalAppendOnlyUnsafeRowArray - #18843
[SPARK-21595] Separate thresholds for buffering and spilling in ExternalAppendOnlyUnsafeRowArray#18843tejasapatil wants to merge 3 commits into
Conversation
tejasapatil
commented
Aug 4, 2017
@hvanhovell : let me know what you think about this. |
SparkQA
commented
Aug 4, 2017
Test build #80236 has finished for PR 18843 at commit
|
hvanhovell
commented
Aug 4, 2017
retest this please |
SparkQA
commented
Aug 4, 2017
Test build #80247 has finished for PR 18843 at commit
|
9f66038 to
398ccafCompareSparkQA
commented
Aug 4, 2017
Test build #80255 has finished for PR 18843 at commit
|
SparkQA
commented
Aug 4, 2017
Test build #80256 has finished for PR 18843 at commit
|
hvanhovell
commented
Aug 9, 2017
retest this please |
hvanhovell
commented
Aug 9, 2017
LGTM - pending jenkins |
There was a problem hiding this comment.
typo? this should be numRowsInMemoryBufferThreshold. We may spill before reaching numRowsSpillThreshold if memory is not enough.
There was a problem hiding this comment.
Yes it was a typo. Corrected it
There was a problem hiding this comment.
can we just have one config for both window and SMJ? ideally we can say this config is for ExternalAppendOnlyUnsafeRowArray
There was a problem hiding this comment.
I am fine with that. We can even go a step further and just have two configs : in-mem threshold and spill threshold at the ExternalAppendOnlyUnsafeRowArray for all its clients (currently SMJ, cartesian product, Window). That way we have consistency across all clients and both knobs. One downside is backward compatibility : spill threshold was already defined per operator level and people might be using it in prod.
Let me know what you think about that.
There was a problem hiding this comment.
ok let's keep them separated for each operator.
There was a problem hiding this comment.
is this a reasonable default value? won't it lead to OOM according to the document?
There was a problem hiding this comment.
It is the current value. I suppose you want to be able to tune it if you have to. Not all of us are running Spark at FB scale :)...
There was a problem hiding this comment.
Before introducing ExternalAppendOnlyUnsafeRowArray, SMJ used to hold in-memory data in scala's ArrayBuffer. Its backed by an array which would at max be Int.MaxValue in size... so this default is keeping things as they were before.
SparkQA
commented
Aug 9, 2017
Test build #80451 has finished for PR 18843 at commit
|
tejasapatil
left a comment
There was a problem hiding this comment.
Updated the PR as per review comments by @cloud-fan. I haven't made changes for all his comments and replied for more discussion in those places
There was a problem hiding this comment.
Yes it was a typo. Corrected it
There was a problem hiding this comment.
I am fine with that. We can even go a step further and just have two configs : in-mem threshold and spill threshold at the ExternalAppendOnlyUnsafeRowArray for all its clients (currently SMJ, cartesian product, Window). That way we have consistency across all clients and both knobs. One downside is backward compatibility : spill threshold was already defined per operator level and people might be using it in prod.
Let me know what you think about that.
There was a problem hiding this comment.
Before introducing ExternalAppendOnlyUnsafeRowArray, SMJ used to hold in-memory data in scala's ArrayBuffer. Its backed by an array which would at max be Int.MaxValue in size... so this default is keeping things as they were before.
SparkQA
commented
Aug 10, 2017
Test build #80504 has finished for PR 18843 at commit
|
There was a problem hiding this comment.
shall we introduce a similar config for cartesian product?
There was a problem hiding this comment.
Sure. Since there was no in-memory buffer for cartesian product before, I am using a conservative value 4096 for the in-memory buffer threshold. However, the spill threshold is set to UnsafeExternalSorter.DEFAULT_NUM_ELEMENTS_FOR_SPILL_THRESHOLD like it was before.
cloud-fan
commented
Aug 11, 2017
LGTM except one question, thanks for the fix! |
cloud-fan
commented
Aug 11, 2017
LGTM, pending jenkins |
cloud-fan
commented
Aug 11, 2017
retest this please |
tejasapatil
commented
Aug 11, 2017
jenkins test this please |
SparkQA
commented
Aug 11, 2017
Test build #80536 has finished for PR 18843 at commit
|
hvanhovell
commented
Aug 11, 2017
Merging to master/2.2. Thanks! |
…nalAppendOnlyUnsafeRowArray ## What changes were proposed in this pull request? [SPARK-21595](https://issues.apache.org/jira/browse/SPARK-21595) reported that there is excessive spilling to disk due to default spill threshold for `ExternalAppendOnlyUnsafeRowArray` being quite small for WINDOW operator. Old behaviour of WINDOW operator (pre #16909) would hold data in an array for first 4096 records post which it would switch to `UnsafeExternalSorter` and start spilling to disk after reaching `spark.shuffle.spill.numElementsForceSpillThreshold` (or earlier if there was paucity of memory due to excessive consumers). Currently the (switch from in-memory to `UnsafeExternalSorter`) and (`UnsafeExternalSorter` spilling to disk) for `ExternalAppendOnlyUnsafeRowArray` is controlled by a single threshold. This PR aims to separate that to have more granular control. ## How was this patch tested? Added unit tests Author: Tejas Patil <tejasp@fb.com> Closes#18843 from tejasapatil/SPARK-21595. (cherry picked from commit 9443999) Signed-off-by: Herman van Hovell <hvanhovell@databricks.com>
…nalAppendOnlyUnsafeRowArray ## What changes were proposed in this pull request? [SPARK-21595](https://issues.apache.org/jira/browse/SPARK-21595) reported that there is excessive spilling to disk due to default spill threshold for `ExternalAppendOnlyUnsafeRowArray` being quite small for WINDOW operator. Old behaviour of WINDOW operator (pre apache#16909) would hold data in an array for first 4096 records post which it would switch to `UnsafeExternalSorter` and start spilling to disk after reaching `spark.shuffle.spill.numElementsForceSpillThreshold` (or earlier if there was paucity of memory due to excessive consumers). Currently the (switch from in-memory to `UnsafeExternalSorter`) and (`UnsafeExternalSorter` spilling to disk) for `ExternalAppendOnlyUnsafeRowArray` is controlled by a single threshold. This PR aims to separate that to have more granular control. ## How was this patch tested? Added unit tests Author: Tejas Patil <tejasp@fb.com> Closesapache#18843 from tejasapatil/SPARK-21595.
…nalAppendOnlyUnsafeRowArray ## What changes were proposed in this pull request? [SPARK-21595](https://issues.apache.org/jira/browse/SPARK-21595) reported that there is excessive spilling to disk due to default spill threshold for `ExternalAppendOnlyUnsafeRowArray` being quite small for WINDOW operator. Old behaviour of WINDOW operator (pre apache#16909) would hold data in an array for first 4096 records post which it would switch to `UnsafeExternalSorter` and start spilling to disk after reaching `spark.shuffle.spill.numElementsForceSpillThreshold` (or earlier if there was paucity of memory due to excessive consumers). Currently the (switch from in-memory to `UnsafeExternalSorter`) and (`UnsafeExternalSorter` spilling to disk) for `ExternalAppendOnlyUnsafeRowArray` is controlled by a single threshold. This PR aims to separate that to have more granular control. ## How was this patch tested? Added unit tests Author: Tejas Patil <tejasp@fb.com> Closesapache#18843 from tejasapatil/SPARK-21595. (cherry picked from commit 9443999) Signed-off-by: Herman van Hovell <hvanhovell@databricks.com>
What changes were proposed in this pull request?
SPARK-21595 reported that there is excessive spilling to disk due to default spill threshold for
ExternalAppendOnlyUnsafeRowArraybeing quite small for WINDOW operator. Old behaviour of WINDOW operator (pre #16909) would hold data in an array for first 4096 records post which it would switch toUnsafeExternalSorterand start spilling to disk after reachingspark.shuffle.spill.numElementsForceSpillThreshold(or earlier if there was paucity of memory due to excessive consumers).Currently the (switch from in-memory to
UnsafeExternalSorter) and (UnsafeExternalSorterspilling to disk) forExternalAppendOnlyUnsafeRowArrayis controlled by a single threshold. This PR aims to separate that to have more granular control.How was this patch tested?
Added unit tests