feat: add errtasks rate limited for retryResync task.
What type of PR is this?
/kind feature
This PR is the resolution of the below github issue. Please review and do the needful.
What this PR does / why we need it:
Reduced memory overhead in the client-go workqueue channel.
We changed queue elements from pointers to string keys and increase the rateLimiter for deletedJob.
We now invoke AddRateLimited only for retry items, reducing duplicate data stored in the workqueue channel and lowering memory usage. When a large number of items are added to the workqueue using AddRateLimited, client-go will apply rate limiting. If rate limiting is triggered, the items are placed into internal Go channels, which can result in additional memory overhead in Go.
Which issue(s) this PR fixes:
Fixes volcano-scheduler memory leak problem
Special notes for your reviewer:
NONE
Does this PR introduce a user-facing change?
NONE
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign monokaix for approval. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
Summary of Changes
Hello @fengruotj, I'm Gemini Code Assist[^1]! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request addresses a memory leak in the "volcano-scheduler" by optimizing the task resynchronization process. It introduces a new function, "retryResyncTask", to specifically manage the retrying of failed tasks. By invoking "AddRateLimited" only for these retry items, the change aims to reduce duplicate data and lower memory usage within the "client-go" workqueue, thereby mitigating the memory overhead issue.
Highlights
- Optimized Task Resynchronization: Introduced a dedicated "retryResyncTask" function to explicitly handle retries for failed task synchronizations, ensuring that "AddRateLimited" is invoked specifically for retry items.
- Memory Overhead Reduction: This change aims to reduce memory overhead in the "client-go" workqueue channel by being more selective about when items are added with rate limiting, addressing a reported memory leak issue.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in pull request comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
[^1]: Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.
/ok-to-test
I mean these are two same methods
emmm, I see. I’ve already fixed it. In the resyncTask method, it was previously using AddRateLimited, and I changed it to Add. If we reach a consensus on this point, I may need to reconsider whether it’s necessary. I think errTasks wil need to execute add function when it firstly come in.
IMO, i feel it should not directly add err task