Skip to content

[SPARK-51974][CONNECT][ML] Limit model size and per-session model cache size #50751

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

WeichenXu123
Copy link
Contributor

@WeichenXu123 WeichenXu123 commented Apr 29, 2025

What changes were proposed in this pull request?

Limit model size and per-session model cache size.

Why are the changes needed?

Motivation: This is for ML cache management, to avoid huge ML cache affecting Spark driver availability.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

UT.

Was this patch authored or co-authored using generative AI tooling?

No.

Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
@WeichenXu123 WeichenXu123 marked this pull request as draft April 29, 2025 09:09
Signed-off-by: Weichen Xu <[email protected]>
@WeichenXu123 WeichenXu123 changed the title [draft] Tree training early stop capped by model size Tree training early stop capped by model size May 1, 2025
@WeichenXu123 WeichenXu123 changed the title Tree training early stop capped by model size [SPARK-51974][CONNECT][ML] Limit model size and per-session model cache size May 1, 2025
@WeichenXu123 WeichenXu123 marked this pull request as ready for review May 1, 2025 14:29

val CONNECT_SESSION_CONNECT_MODEL_MAX_SIZE =
buildConf("spark.connect.session.connectML.model.maxSize")
.doc("Maximum size of the SparkML model. The size is in bytes.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "the SparkML model" -> "a single SparkML model"

@@ -61,6 +61,31 @@ private[connect] class MLCache(sessionHolder: SessionHolder) extends Logging {

private[ml] val totalSizeBytes: AtomicLong = new AtomicLong(0)

private[ml] val totalModelCacheSizeBytes: AtomicLong = new AtomicLong(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "totalSizeBytes" above is tracking the total size in memory. Why do we need to use a different totalModelCacheSizeBytes?

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

Successfully merging this pull request may close these issues.

2 participants