Skip to content

agent scheduler: design doc update - #4801

Merged
volcano-sh-bot merged 2 commits into
volcano-sh:masterfrom
qi-min:agent-scheduler-design
Dec 19, 2025
Merged

agent scheduler: design doc update#4801
volcano-sh-bot merged 2 commits into
volcano-sh:masterfrom
qi-min:agent-scheduler-design

Conversation

@qi-min

@qi-min qi-min commented Dec 11, 2025

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind docs

What this PR does / why we need it:

Design doc for a new scheduler to support fast scheduling of Agent Workload
Proposal details: proposal

Which issue(s) this PR fixes:

Fixes #
#4722

Special notes for your reviewer:

Does this PR introduce a user-facing change?


@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @qi-min, 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 a comprehensive design document for a new 'Agent Scheduler' within the Volcano project. The primary goal is to provide a specialized, high-performance scheduling solution for latency-sensitive AI Agent workloads, which the current Volcano Scheduler is not optimally suited for. The design emphasizes rapid task scheduling, high throughput, and seamless collaboration with the existing Volcano Scheduler through an innovative node sharding mechanism. It outlines a detailed architecture, including a multi-worker framework, an optimized scheduling queue, and a conflict-aware binder, all aimed at improving overall cluster efficiency and workload management for diverse computational demands.

Highlights

  • Introduction of Agent Scheduler Design: This pull request adds a new design document outlining the architecture and functionality of an 'Agent Scheduler' to address limitations of the existing Volcano Scheduler for specific workload types.
  • Addressing Latency-Sensitive Workloads: The Agent Scheduler is designed to handle latency-sensitive AI Agent workloads with frequent task creation, aiming for ultra-fast scheduling, high throughput, and guaranteed low per-task scheduling latency.
  • Collaborative Shard-Based Scheduling: The design proposes a collaborative model where the Agent Scheduler works alongside the Volcano Scheduler, utilizing a 'Sharding Controller' to dynamically divide nodes into shards, enabling parallel scheduling of different workload types.
  • Optimized Scheduling Framework: The document details a new scheduling framework including a hierarchical component structure (Scheduler, Worker, Framework, Snapshot, Action, Plugin), an efficient scheduling queue inspired by kube-scheduler with an 'Urgent Retry Mechanism' for binding conflicts, and multi-worker parallel scheduling with optimistic concurrency control.
  • Dynamic Sharding Synchronization: It introduces a mechanism for sharding synchronization using NodeShard Custom Resources, allowing schedulers to dynamically adapt to changes in node assignments and coordinate resource usage across different schedulers with configurable sharding modes (none, soft, hard).
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 👍 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

  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.

@volcano-sh-bot volcano-sh-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 11, 2025

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 introduces a design document for a new Agent Scheduler. The document is well-structured and provides a good overview of the proposed architecture, including problem statement, design goals, components, and scheduling workflow. My review focuses on improving clarity, fixing typos and grammatical errors, and pointing out incomplete sections to ensure the design is robust and easy to understand. I've identified some issues in the YAML examples that need to be corrected to be valid.

Comment thread docs/design/agent-scheduler.md Outdated
Comment thread docs/design/agent-scheduler.md Outdated
Comment thread docs/design/agent-scheduler.md
Comment thread docs/design/agent-scheduler.md
Comment thread docs/design/agent-scheduler.md Outdated
Comment thread docs/design/agent-scheduler.md Outdated
Comment thread docs/design/agent-scheduler.md
Comment thread docs/design/agent-scheduler.md
Signed-off-by: qi-min <qim_34@163.com>
@qi-min
qi-min force-pushed the agent-scheduler-design branch from f7fdaac to 6ce688b Compare December 11, 2025 08:34
2. The scheduling strategy for an Agent might be different from other workloads. Agent workloads may not require topology spread or pod affinity. Instead, they can be scheduled onto nodes with smaller or fragmented resources to better utilize resource fragments and improve overall cluster efficiency. This requires different scheduling strategies configured for different workloads.


### Design Goal

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Define clear KPIs (e.g., "Support 5000 nodes, 1000 Pods/s throughput with P99 scheduling latency < 200ms").

metadata:
name: volcano
spec:
nodesDesired: #Nodes should be used within this shard.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The nodes in nodesDesired is configured by user manually?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also how to allocate nodes among multiple schedulers?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

nodesDesired is assigned by sharding-controller, sharding-controller is response for collect metrics and adjust nodes in NodeShard

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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


4. If none of the nodes in the result are available, the Pod is push back to the scheduling queue in high priority for re-scheduling. E.g. both nodes allocated for Pod C are based on v1 that is used in previous bind, so both node are rejected by binder and binder push Pod C back to queue.

5. In new allocation based on node with updated binding version, binder will treat the allocation is based on new resource view of node and then allow binding. E.g. node1 (v2) is allocated for Pod D based previous bound Pod information in node, so it is not treated as a conflict.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The Pod D is binded to node 1, set node 1 v3 in the binder-flow.png, maybe not correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After Pod D bind 同node1, then update the bindversion of node1 from v2 to v3. Next pod (let's say Pod E) scheduled to Node1 after bind version change is based on node 1 v3, version v3 is higher than v2 which is used in last binding on node 1, so binder will allow binding Pod E to node 1


![](images/agent-scheduler/binder-flow.png)

1. Each scheduling result records more than one allocatable nodes (number is configurable), with binding version recorded in each node at the time of allocation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Who generate binding version and how is it updated?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

At step 2. binder will change bind version after a node checking passed.

### Architecture Overview
An independent Agent scheduler is introduced to identify and make fast scheduling for Agent workloads. The scheduler improves the scheduling rate of individual Pods through optimized scheduling strategies and in-time Pod scheduling. It further increases overall scheduling throughput by leveraging parallel scheduling with multiple workers.

When Agent workloads coexist with other workloads, the sharding controller dynamically divides nodes into shards based on defined policies like resource threshold, node type, etc. Each scheduler obtains schedulable nodes through shard synchronization and selects or prioritizes the corresponding nodes for scheduling. This enables multiple schedulers to perform parallel scheduling of different workloads based on different shards. Refer to the [sharding controller design and shard strategy](shard-controller.md) for details.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

shard-controller.md missing now

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@hzxuzhonghu shard-controller.md is in pr

- **Unschedulable Pods Pool**: Stores pods that have failed scheduling and are determined to be unschedulable under current cluster conditions.

A key enhancement over the standard queue logic is the **Urgent Retry Mechanism** for binding conflicts.
When the Conflict-Aware Binder detects a conflict (i.e., multiple workers trying to bind to the same node),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should this happen? I kind of remember the coordinator in agent-scheduler will allocate nodes to different workers

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

based on latest design, all workers in agent-scheduler share nodes in same shard to avoid cutting nodes in shard into small pieces, so a binder is introduced to check conflict

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am very concerned with the conflicts probability. not sure did you check the conflict metrics during test

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

In current test with in small scale, conflict rate is low when candidate nodes number exceed worker count, e.g. 3 candidates in each allocate and 2 workers.
I agree we need add metrics for conflicting and test in large concurrence to find out a proper ratio between candidates number and worker number which may have lowest conflict rate

Comment thread docs/design/agent-scheduler.md Outdated

1. When new unscheduled pending pods are watched, they are added to the **activeQ**, the pods will be popped from the **activeQ** and tried to be scheduled.
2. If scheduling fails for the pod, it will be added to the **unschedulable pods pool**.
3. When cluster events occur (such as node updates, pod deletions, etc.), the scheduler checks pods in the **unschedulable pods pool**, if the event makes a pod potentially schedulable, the pod is moved to either **backoffQ** or **activeQ**, depending on whether it is still within its backoff period.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It does not document the backoffQ clearly, when a pod is enqueued

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A pod scheduling state machine or other design diagrams might make this concept clearer.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for your suggestions, I have added a scheduling queue diagram, please check @MahaoAlex
And about the backoffQ I have already explain in the front, but I refined it a bit more, please check @hzxuzhonghu :

BackoffQ: Stores pods that are potentially schedulable (e.g., triggered by cluster events) but are waiting for a backoff period to expire. This prevents the scheduler from being overwhelmed by frequent retries, ensuring high scheduling throughput.

BackoffQ primarily avoids invalid events and prevents the repeated checking of unschedulable pods, thereby improving throughput.

Comment thread docs/design/agent-scheduler.md
Signed-off-by: JesseStutler <chenzicong4@huawei.com>

@hzxuzhonghu hzxuzhonghu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@volcano-sh-bot volcano-sh-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 19, 2025
@volcano-sh-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@volcano-sh-bot volcano-sh-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 19, 2025
@volcano-sh-bot
volcano-sh-bot merged commit 547e9d0 into volcano-sh:master Dec 19, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants