[SPARK-58021][CONNECT] Integrate local server pools with SparkSession - #57102
Open
ericm-db wants to merge 5 commits into
Open
[SPARK-58021][CONNECT] Integrate local server pools with SparkSession#57102ericm-db wants to merge 5 commits into
ericm-db wants to merge 5 commits into
Conversation
ericm-db
force-pushed
the
local-connect-pool
branch
from
July 30, 2026 23:28
e350657 to
462580e
Compare
ericm-db
marked this pull request as ready for review
July 31, 2026 16:26
Expose the per-user runtime directory and startup seed configuration, and let LocalConnectServer start isolated daemons with an ephemeral port and precomputed configuration. Keep persistent-server reuse on the same launch path and add focused unit coverage.
ericm-db
force-pushed
the
local-connect-pool
branch
from
July 31, 2026 17:08
17787fa to
f43947b
Compare
Contributor
Author
|
This PR is now stacked on #57684, which contains the behavior-preserving local-server launch refactor. Please review that foundation first; after it merges, this PR will reduce to the pool implementation, SparkSession integration, documentation, and pool tests. |
Co-authored-by: Isaac Claude-Session: https://claude.ai/code/session_011tpdLYqY4VRw4s1KjDb2fi
Co-authored-by: Isaac Claude-Session: https://claude.ai/code/session_011tpdLYqY4VRw4s1KjDb2fi
Co-authored-by: Isaac Claude-Session: https://claude.ai/code/session_011tpdLYqY4VRw4s1KjDb2fi
Co-authored-by: Isaac Claude-Session: https://claude.ai/code/session_011tpdLYqY4VRw4s1KjDb2fi
ericm-db
force-pushed
the
local-connect-pool
branch
from
July 31, 2026 18:20
f43947b to
320bffc
Compare
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?
This is layer 5 of the local Connect pool stack: #57684 -> #57685 -> #57686 -> #57687 -> this PR. JIT warmup is isolated in follow-up #57688. Until the lower layers merge, GitHub shows their cumulative diff; the new review unit here is commit
320bffceae6.This layer wires the pool into the public SparkSession construction path:
SparkSession.builder.remote("local[*]")selects the pool whenspark.local.connect.pool=trueorSPARK_LOCAL_CONNECT_POOL=1is set;Each opted-in application run claims a booted server that has never served another run, starts a replacement in the background, and retires its server when the owning session stops. No server serves two application runs.
Why are the changes needed?
Local Connect startup pays for a JVM and SparkContext in every Python process. Persistent reuse removes that cost but can carry SparkContext-backed state across runs. The single-use pool preserves fresh-server-per-run isolation while moving server startup off the critical path after the initial pool bootstrap.
Keeping this integration separate from storage, lifecycle, acquisition, and warmup makes the user-facing dispatch and session ownership rules independently reviewable.
Does this PR introduce any user-facing change?
Yes, only when the experimental opt-in is enabled. With
SPARK_LOCAL_CONNECT_POOL=1orspark.local.connect.pool=true, a local remotegetOrCreate()claims a never-used local Connect server from the pool instead of starting an in-process server. The claimed server is retired when the owning session stops. With the opt-in unset, behavior is unchanged. The mode is POSIX-only, like persistent local server reuse.How was this patch tested?
The pool suite includes unit coverage for storage, lifecycle, acquisition, release, purge, and platform handling plus end-to-end tests using real local Connect servers.
Results on this branch:
git diff --checkpassed.The initial clone-session attempt used the host default Python 3.6 worker and failed because that interpreter lacks
importlib.resources; rerunning with the test Python 3.11 venv explicitly selected for workers passed all 8 tests.Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Fable 5) and OpenAI Codex (GPT-5)