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

clean memory scaler object when pa crd is deleted #520

Merged
merged 1 commit into from
Dec 13, 2024

Conversation

kr11
Copy link
Collaborator

@kr11 kr11 commented Dec 11, 2024

Pull Request Description

[Please provide a clear and concise description of your changes here]

This PR addresses an issue where deleting a PA object does not remove the associated scaler object from memory, potentially leading to increased memory usage and bugs upon PA recreation.

Changes Introduced:

  • Added cleaning logic that triggers when a PA is detected as deleted.
  • Enhanced the NamespaceMetric structure to include PA information. Previously, it only contained TargetRef details. Now, it also records the PA's namespace and name, which are accessible post-deletion.

logs when creating pa:

I1211 16:07:48.072607   55435 podautoscaler_controller.go:658] "New scaler added to AutoscalerMap" metricKey="default/mock-llama2-7b" type="KPA" spec={"scaleTargetRef":{"kind":"Deployment","name":"mock-llama2-7b","apiVersion":"apps/v1"},"minReplicas":0,"maxReplicas":10,"metricsSources":[{"metricSourceType":"pod","protocolType":"http","path":"metrics","port":"8000","targetMetric":"avg_prompt_throughput_toks_per_s","targetValue":"60"}],"scalingStrategy":"KPA"}

logs when deleting pa:

I1211 16:08:02.635597   55435 podautoscaler_controller.go:135] "Delete scaler" PaName="podautoscaler-mock-llama2-7b" PaNamespace="default" TargetRefNamespace="default" TargetRefName="podautoscaler-mock-llama2-7b"
I1211 16:08:03.391976   55435 podautoscaler_controller.go:167] PodAutoscaler resource not found. Clean scaler object in memory since object default/podautoscaler-mock-llama2-7b must have been deleted

Contribution Guidelines (Expand for Details)

We appreciate your contribution to aibrix! To ensure a smooth review process and maintain high code quality, please adhere to the following guidelines:

Pull Request Title Format

Your PR title should start with one of these prefixes to indicate the nature of the change:

  • [Bug]: Corrections to existing functionality
  • [CI]: Changes to build process or CI pipeline
  • [Docs]: Updates or additions to documentation
  • [API]: Modifications to aibrix's API or interface
  • [CLI]: Changes or additions to the Command Line Interface
  • [Misc]: For changes not covered above (use sparingly)

Note: For changes spanning multiple categories, use multiple prefixes in order of importance.

Submission Checklist

  • PR title includes appropriate prefix(es)
  • Changes are clearly explained in the PR description
  • New and existing tests pass successfully
  • Code adheres to project style and best practices
  • Documentation updated to reflect changes (if applicable)
  • Thorough testing completed, no regressions introduced

By submitting this PR, you confirm that you've read these guidelines and your changes align with the project's contribution standards.

@kr11 kr11 requested a review from Jeffwan December 11, 2024 08:24
@Jeffwan Jeffwan merged commit a3806d9 into main Dec 13, 2024
10 checks passed
@Jeffwan Jeffwan deleted the kangrong/features/clean_deleted_pa_memory branch December 13, 2024 17:45
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.

2 participants