Skip to content

[SPARK-57467][SCHEDULER] Reuse identical resource profiles when available#56516

Open
psavalle wants to merge 1 commit into
apache:masterfrom
psavalle:pa/resource-profile-get-or-add
Open

[SPARK-57467][SCHEDULER] Reuse identical resource profiles when available#56516
psavalle wants to merge 1 commit into
apache:masterfrom
psavalle:pa/resource-profile-get-or-add

Conversation

@psavalle

@psavalle psavalle commented Jun 15, 2026

Copy link
Copy Markdown

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.

ResourceProfileManager has a method getEquivalentProfile, but it is only called in DAGScheduler.mergeResourceProfilesForStage when stageResourceProfiles.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?

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant