-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[Doc] Add scheduler cache and snapshot design #4856
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
base: master
Are you sure you want to change the base?
[Doc] Add scheduler cache and snapshot design #4856
Conversation
Summary of ChangesHello @handan-yxh, I'm Gemini Code Assist1! 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 introduces comprehensive documentation for the Agent scheduler's cache and snapshot design. The update details significant optimizations aimed at enhancing scheduling throughput and concurrency, including advanced data structures and mechanisms for efficient, incremental updates and parallel processing across multiple workers. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe 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
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 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 👍 and 👎 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. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds valuable documentation for the scheduler cache and snapshot design, replacing the 'TBD' section with a clear and detailed explanation of the optimizations. The new content is well-structured and informative. My review includes a couple of minor formatting suggestions to improve readability.
docs/design/agent-scheduler.md
Outdated
| Design of snapshot fast update mechanism and why. | ||
| TBD | ||
| To improve the overall scheduling throughput of the Agent scheduler, we optimized the Cache and Snapshot data structures and algorithms. | ||
| 1. **Generation-based Incremental Updates**: Each node in the cache maintains a monotonically increasing generation number. When a node's state changes (pod addition/removal, resource updates), its generation is incremented and the node is moved to the head of a doubly linked list. During snapshot updates, only nodes with generation numbers greater than the snapshot's current generation are processed.Significantly reduces the number of nodes that need to be processed for each update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be a missing space after the period, which affects readability. Please add a space between the sentences.
| 1. **Generation-based Incremental Updates**: Each node in the cache maintains a monotonically increasing generation number. When a node's state changes (pod addition/removal, resource updates), its generation is incremented and the node is moved to the head of a doubly linked list. During snapshot updates, only nodes with generation numbers greater than the snapshot's current generation are processed.Significantly reduces the number of nodes that need to be processed for each update. | |
| 1. **Generation-based Incremental Updates**: Each node in the cache maintains a monotonically increasing generation number. When a node's state changes (pod addition/removal, resource updates), its generation is incremented and the node is moved to the head of a doubly linked list. During snapshot updates, only nodes with generation numbers greater than the snapshot's current generation are processed. Significantly reduces the number of nodes that need to be processed for each update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll fix it.
docs/design/agent-scheduler.md
Outdated
| - Doubly Linked List: Maintains nodes in recency order (most recently updated at head). | ||
| - Hash Map: Provides O(1) node lookup by name. | ||
| - Indexed Snapshot: Snapshot maintains maps for quick node position lookup. | ||
| 3. **Concurrent Access Support**: The read-write lock separation design supports multiple workers concurrently accessing and updating their individual snapshots. Each worker maintains an independent snapshot instance, avoiding contention during scheduling cycles.Significantly improves concurrency performance in multithreaded scenarios. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appears to be a missing space after the period, which affects readability. Please add a space between the sentences.
| 3. **Concurrent Access Support**: The read-write lock separation design supports multiple workers concurrently accessing and updating their individual snapshots. Each worker maintains an independent snapshot instance, avoiding contention during scheduling cycles.Significantly improves concurrency performance in multithreaded scenarios. | |
| 3. **Concurrent Access Support**: The read-write lock separation design supports multiple workers concurrently accessing and updating their individual snapshots. Each worker maintains an independent snapshot instance, avoiding contention during scheduling cycles. Significantly improves concurrency performance in multithreaded scenarios. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'll fix it.
docs/design/agent-scheduler.md
Outdated
| ## Snapshot maintenance | ||
| Design of snapshot fast update mechanism and why. | ||
| TBD | ||
| To improve the overall scheduling throughput of the Agent scheduler, we optimized the Cache and Snapshot data structures and algorithms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add some background about the purpose of snapshot and relationships between snapshot and nodes in cache
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some background information has been added.
docs/design/agent-scheduler.md
Outdated
| ## Snapshot maintenance | ||
| Design of snapshot fast update mechanism and why. | ||
| TBD | ||
| To improve the overall scheduling throughput of the Agent scheduler, we optimized the Cache and Snapshot data structures and algorithms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer more information about how the snapshot lifecycle is managed, such as when snapshots are created, updated and deleted, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some text has been added, and simple diagrams will be used to describe the lifecycle more clearly.
docs/design/agent-scheduler.md
Outdated
| Design of snapshot fast update mechanism and why. | ||
| TBD | ||
| To improve the overall scheduling throughput of the Agent scheduler, we optimized the Cache and Snapshot data structures and algorithms. | ||
| 1. **Generation-based Incremental Updates**: Each node in the cache maintains a monotonically increasing generation number. When a node's state changes (pod addition/removal, resource updates), its generation is incremented and the node is moved to the head of a doubly linked list. During snapshot updates, only nodes with generation numbers greater than the snapshot's current generation are processed.Significantly reduces the number of nodes that need to be processed for each update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the processing logic of the incremental update here, it would be better to have a simple schematic diagram.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I will add a diagram.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
80ee99b to
79bce58
Compare
79bce58 to
18a891c
Compare
|
/retest |
|
@qi-min: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/retest |
18a891c to
efc0e62
Compare
Signed-off-by: handan-yxh <[email protected]>
Signed-off-by: handan-yxh <[email protected]>
efc0e62 to
edbea94
Compare
What type of PR is this?
doc
What this PR does / why we need it:
Add scheduler cache and snapshot design
Proposal details: https://docs.google.com/document/d/1NDTEGulhQ__sdZ_c2kN3ojtJIZie5O7_GyZyKIOLz-g/edit?tab=t.3q3qlfh4r4sf#heading=h.9r4wotc3nl4d
Which issue(s) this PR fixes:
Fixes #4722
Special notes for your reviewer:
Does this PR introduce a user-facing change?
NONE