Skip to content
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

[RayService][Refactor] Change the data structure of ServeConfigs to avoid iterating the whole map #2550

Open
1 of 2 tasks
Tracked by #2548
kevin85421 opened this issue Nov 17, 2024 · 0 comments
Open
1 of 2 tasks
Tracked by #2548
Assignees
Labels

Comments

@kevin85421
Copy link
Member

kevin85421 commented Nov 17, 2024

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

func (r *RayServiceReconciler) cleanUpServeConfigCache(ctx context.Context, rayServiceInstance *rayv1.RayService) {
logger := ctrl.LoggerFrom(ctx)
activeConfigKey := r.generateConfigKey(rayServiceInstance, rayServiceInstance.Status.ActiveServiceStatus.RayClusterName)
pendingConfigKey := r.generateConfigKey(rayServiceInstance, rayServiceInstance.Status.PendingServiceStatus.RayClusterName)
configPrefix := r.generateConfigKeyPrefix(rayServiceInstance)
// Clean up RayCluster serve deployment configs.
for key := range r.ServeConfigs.Items() {
if key == activeConfigKey || key == pendingConfigKey {
continue
}
if !strings.HasPrefix(key, configPrefix) {
// Skip configs owned by other RayService Instance.
continue
}
logger.Info("cleanUpServeConfigCache", "activeConfigKey", activeConfigKey, "pendingConfigKey", pendingConfigKey, "remove key", key)
r.ServeConfigs.Remove(key)
}
}

Currently, the key of ServeConfigs is ${RAY_SERVICE_NAMESPACE}/${RAY_SERVICE_NAME}/${RAY_CLUSTER_NAME}. Hence, cleanUpServeConfigCache needs to iterate the whole map to find the keys which belong to this RayService CR.

Maybe we can change the key to ${RAY_SERVICE_NAMESPACE}/${RAY_SERVICE_NAME}/, and the value to a map where the key is ${RAY_CLUSTER_NAME} and the value is ServeConfigV2.

Use case

No response

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants