[SPARK-57467][SCHEDULER] Reuse identical resource profiles when available#56516
Open
psavalle wants to merge 2 commits into
Open
[SPARK-57467][SCHEDULER] Reuse identical resource profiles when available#56516psavalle wants to merge 2 commits into
psavalle wants to merge 2 commits into
Conversation
Author
|
Not really sure would could have a look, maybe @wbo4958? Thank you! |
uros-b
reviewed
Jun 17, 2026
Member
|
Regarding the PR description, it seems that there actually is an observable behavior change. Repeated CreateResourceProfile calls with identical resources now return the same profile ID instead of a new one each time. So, equivalent profiles now share executors under dynamic allocation instead of each getting a separate pool. If there is a user-facing change, it should be notead and we will need an appropriate release note. |
Member
|
In any case, I don't have full context here - so @tgravescs @wbo4958 @HyukjinKwon @Ngone51 please review this PR. |
Author
|
Makes sense, I've updated the PR description, thank you. |
Contributor
|
+CC @max2718281 PTAL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
When registering a resource profile, check if one with the same requests already exists. If so, return it, so that the same executors can be reused.
ResourceProfileManagerhas a methodgetEquivalentProfile, but it is only called inDAGScheduler.mergeResourceProfilesForStagewhenstageResourceProfiles.size > 1. Even there, it seems it may be prone to a race condition since it does not acquire the lock for both steps (checking for a profile, adding one if needed).Why are the changes needed?
Currently, every time a profile is registered, new executors will need to spin up -- even if the resource requests are the same. This is especially problematic with Spark Connect, where different isolated sessions may try and register the same profile, but all end up with isolated executors.
We could also consider putting this behavior behind a configuration flag, if it is desirable to retain the previous behavior by default.
Does this PR introduce any user-facing change?
Previously, equivalent resource profiles would get different profile IDs, and separate executors.
With this change, equivalent resource profiles will get the same ID, and share executors.
How was this patch tested?
Added tests
Was this patch authored or co-authored using generative AI tooling?
Yes, modified initial changes provided by Claude.
Generated-by: 2.1.159 (Claude Code)