[ 
https://issues.apache.org/jira/browse/SPARK-62360?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eddie Hsiao updated SPARK-62360:
--------------------------------
    Description: 
AQE shuffle-reader locality lookup should apply the existing task-count limits

Large AQE shuffles can spend driver work constructing map-host locality 
preferences even when they exceed the task-count limits used by the neighboring 
shuffle-locality method.

In MapOutputTrackerMaster, getPreferredLocationsForShuffle only computes 
size-based locality when the shuffle has fewer than 1000 maps and fewer than 
1000 reduce partitions. getMapLocation checks only 
spark.shuffle.reduceLocality.enabled, then slices map statuses, filters missing 
entries, and constructs/deduplicates the host list. It does this even when the 
whole shuffle exceeds those limits.

Proposed scope: apply the same existing map/reducer task-count thresholds to 
getMapLocation. Keep disabled-locality short-circuiting, valid small-shuffle 
preferences, host deduplication, missing outputs and range validation. No new 
configuration or API is needed. This changes locality hints for large shuffles, 
not query results. A performance speedup has not been measured.

Source inspected and tested: Apache master 
b17f03c04ef38900bad0eae41d3ef88163d9dede.

Related work: https://issues.apache.org/jira/browse/SPARK-38401 and 
https://github.com/apache/spark/pull/35719 proposed a broader AQE locality 
rewrite, including fraction-based host selection; that PR was closed without 
merging. SPARK-42719 addressed honoring the locality-enable setting and is 
already fixed. This issue concerns only the remaining task-count guards, not 
unifying the locality methods or changing fraction-based selection.

Validation: added nine cases in MapOutputTrackerSuite covering 999/1000/1001 
map/reduce boundaries, both dimensions below/at the thresholds, range 
validation, missing outputs/shuffle, and host deduplication. All 10 focused 
getMapLocation tests pass, including the existing locality-disabled case. The 
full suite has 49 passes, zero failures and one existing ignored multi-GiB 
case. core/scalastyle reports zero errors/warnings. Tests ran on JDK 21.

Generated-by: Metamate (sparky; tool version not exposed by runtime). Human 
review is pending.


Draft implementation: https://github.com/apache/spark/pull/60892


  was:
AQE shuffle-reader locality lookup should apply the existing task-count limits

Large AQE shuffles can spend driver work constructing map-host locality 
preferences even when they exceed the task-count limits used by the neighboring 
shuffle-locality method.

In MapOutputTrackerMaster, getPreferredLocationsForShuffle only computes 
size-based locality when the shuffle has fewer than 1000 maps and fewer than 
1000 reduce partitions. getMapLocation checks only 
spark.shuffle.reduceLocality.enabled, then slices map statuses, filters missing 
entries, and constructs/deduplicates the host list. It does this even when the 
whole shuffle exceeds those limits.

Proposed scope: apply the same existing map/reducer task-count thresholds to 
getMapLocation. Keep disabled-locality short-circuiting, valid small-shuffle 
preferences, host deduplication, missing outputs and range validation. No new 
configuration or API is needed. This changes locality hints for large shuffles, 
not query results. A performance speedup has not been measured.

Source inspected and tested: Apache master 
b17f03c04ef38900bad0eae41d3ef88163d9dede.

Related work: https://issues.apache.org/jira/browse/SPARK-38401 and 
https://github.com/apache/spark/pull/35719 proposed a broader AQE locality 
rewrite, including fraction-based host selection; that PR was closed without 
merging. SPARK-42719 addressed honoring the locality-enable setting and is 
already fixed. This issue concerns only the remaining task-count guards, not 
unifying the locality methods or changing fraction-based selection.

Validation: added nine cases in MapOutputTrackerSuite covering 999/1000/1001 
map/reduce boundaries, both dimensions below/at the thresholds, range 
validation, missing outputs/shuffle, and host deduplication. All 10 focused 
getMapLocation tests pass, including the existing locality-disabled case. The 
full suite has 49 passes, zero failures and one existing ignored multi-GiB 
case. core/scalastyle reports zero errors/warnings. Tests ran on JDK 21.

Generated-by: Metamate (sparky; tool version not exposed by runtime). Human 
review is pending.



> Bound AQE shuffle-locality lookup for large shuffles
> ----------------------------------------------------
>
>                 Key: SPARK-62360
>                 URL: https://issues.apache.org/jira/browse/SPARK-62360
>             Project: Spark
>          Issue Type: Improvement
>          Components: Spark Core
>    Affects Versions: 5.0.0
>            Reporter: Eddie Hsiao
>            Priority: Major
>
> AQE shuffle-reader locality lookup should apply the existing task-count limits
> Large AQE shuffles can spend driver work constructing map-host locality 
> preferences even when they exceed the task-count limits used by the 
> neighboring shuffle-locality method.
> In MapOutputTrackerMaster, getPreferredLocationsForShuffle only computes 
> size-based locality when the shuffle has fewer than 1000 maps and fewer than 
> 1000 reduce partitions. getMapLocation checks only 
> spark.shuffle.reduceLocality.enabled, then slices map statuses, filters 
> missing entries, and constructs/deduplicates the host list. It does this even 
> when the whole shuffle exceeds those limits.
> Proposed scope: apply the same existing map/reducer task-count thresholds to 
> getMapLocation. Keep disabled-locality short-circuiting, valid small-shuffle 
> preferences, host deduplication, missing outputs and range validation. No new 
> configuration or API is needed. This changes locality hints for large 
> shuffles, not query results. A performance speedup has not been measured.
> Source inspected and tested: Apache master 
> b17f03c04ef38900bad0eae41d3ef88163d9dede.
> Related work: https://issues.apache.org/jira/browse/SPARK-38401 and 
> https://github.com/apache/spark/pull/35719 proposed a broader AQE locality 
> rewrite, including fraction-based host selection; that PR was closed without 
> merging. SPARK-42719 addressed honoring the locality-enable setting and is 
> already fixed. This issue concerns only the remaining task-count guards, not 
> unifying the locality methods or changing fraction-based selection.
> Validation: added nine cases in MapOutputTrackerSuite covering 999/1000/1001 
> map/reduce boundaries, both dimensions below/at the thresholds, range 
> validation, missing outputs/shuffle, and host deduplication. All 10 focused 
> getMapLocation tests pass, including the existing locality-disabled case. The 
> full suite has 49 passes, zero failures and one existing ignored multi-GiB 
> case. core/scalastyle reports zero errors/warnings. Tests ran on JDK 21.
> Generated-by: Metamate (sparky; tool version not exposed by runtime). Human 
> review is pending.
> Draft implementation: https://github.com/apache/spark/pull/60892



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to