Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5826cec

Browse files
committedMar 28, 2025··
Scheduler subsystem high level design proposal
This sets down basic design principles of the current gateway scheduler. We also highlight who we are targeting as users, and why we prioritize the current approach. It also selects standard terminology for scheduling that the implementation should adopt. This is a high level design and thus sets general scope, without expecting to fully address all problems.
1 parent 61125a8 commit 5826cec

File tree

1 file changed

+150
-0
lines changed

1 file changed

+150
-0
lines changed
 

Diff for: ‎docs/proposals/006-scheduler/README.md

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Gateway API Scheduler
2+
3+
Authors: @kfswain, @smarterclayton
4+
5+
## Proposal Status
6+
***Draft***
7+
8+
## Table of Contents
9+
10+
<!-- toc -->
11+
12+
- [Summary](#summary)
13+
- [Goals](#goals)
14+
- [Non-Goals](#non-goals)
15+
- [Proposal](#proposal)
16+
- [Personas](#personas)
17+
- [Requirements](#requirements)
18+
- [Design](#design)
19+
- [Alternatives](#alternatives)
20+
- [FAQ](#faq)
21+
- [Open Questions](#open-questions)
22+
23+
<!-- /toc -->
24+
25+
## Summary
26+
27+
This proposal defines the inference gateway scheduler subsystem and constrains its scope. The scheduler is responsible for determining which endpoints the load balancer should route requests to. Future proposals may extend its scope.
28+
29+
## Goals
30+
31+
- The scheduler should be reasonably fast - decide request mapping to endpoints within O(10ms) on average
32+
- The scheduler should be effective - requiring little configuration out of the box to get great performance
33+
- The scheduler should be maintainable - new in-tree features should compose cleanly
34+
- The scheduler should be forkable - downstream consumers should expect some stability of interface
35+
- The scheduler should be educatable - extending the [model server protocol](../003-model-server-protocol/) with new metrics or adding a new source of data should be minimally invasive
36+
- The scheduler should be replaceable - the reference endpoint picker implementation should support delegating scheduling decisions per pool to an alternative **replacement scheduler**
37+
38+
## Non-Goals
39+
40+
- Dynamic reconfiguration of the reference scheduler algorithms at runtime
41+
- Being a general scheduler framework for load balancing
42+
- Determining the characteristics of the underlying model servers and hardware
43+
44+
## Proposal
45+
46+
### Personas
47+
48+
These are the personas we target with the scheduler subsystem:
49+
50+
#### OSS Algorithm Researcher
51+
52+
The OSS Researcher forks and extends the reference scheduler to add new algorithmic improvements and shows how it impacts workloads. They:
53+
54+
- Provide a replacement scheduler OR extend the reference scheduler
55+
- Test their changes repeatedly against a set of scenarios
56+
- Validate that their changes do not regress other scenarios
57+
- Propose changes to the reference scheduler or the replacement scheduler protocol
58+
59+
#### Production Algorithm Contributor
60+
61+
The production algorithm contributor is an ML engineer or platform owner who observes that a specific scheduling outcome is non-optimal for their workloads and must rapidly fix the issue and get it live. They:
62+
63+
- Fix a scheduler bug OR Extend the reference scheduler with changes specific to their environment
64+
- Quickly deploy a custom EPP with their changes to their environment, and sustain that fix until upstream merges
65+
- Add new test cases to validate their issue is resolved and does not regress
66+
- If necessary, open a feature request and proposal to cover the novel requirement
67+
68+
#### Inference Platform Admin
69+
70+
The Inference Platform Admin creates and manages the infrastructure necessary to run LLM workloads. They:
71+
72+
- Configure the model server under an InferencePool to accomplish the objectives of the workloads
73+
- Configure the scheduler associated with an InferencePool to be more efficient or more predictable
74+
- Observe rollouts for degradation of existing workload performance and stop rollout
75+
76+
#### Inference Workload Owner
77+
78+
An Inference Workload Owner persona owns and manages 1 or many Generative AI Workloads. They:
79+
80+
- Configure API objects to leverage new algorithm features in test and production environments
81+
- Reproducibly measure production traffic against new algorithms
82+
- Identify regressions in performance when new algorithm changes are rolled out via alerting
83+
84+
### Requirements
85+
86+
We desire the following outcomes from the reference scheduler:
87+
88+
1. Keep model servers optimally utilized without saturating
89+
2. Make user-visible request latency more predictable
90+
3. Provide isolation between multiple workloads on the same model servers before saturation
91+
4. Prioritize and fairly share resources between multiple workloads on the same model servers after saturation
92+
93+
We desire the following outcomes from the act of using a replacement scheduler:
94+
95+
1. Fast iteration with the ML ecosystem, namely other languages
96+
2. Benefit from existing informers without having multiple implementations
97+
3. Acceptable speed of scheduling for 10-1000 QPS systems
98+
99+
### Design
100+
101+
We expect the following challenges to be addressed by the reference scheduler design:
102+
103+
1. Understand the cost of an incoming request and its impact on the target model server before placing it
104+
2. Track the cost of previously issued requests to avoid overloading servers
105+
3. Integrate future cost features such as prefix cache routing into a holistic cost model
106+
4. Support heterogenous model server capabilities in terms of capacity, latency, memory, and features
107+
108+
#### Reference Scheduler
109+
110+
The reference scheduler will be a monolithic Golang scheduler that is expected to run cooperatively with other instances of the scheduler with the same configuration or with appropriate 1 version/config skew.
111+
112+
The reference scheduler receives a list of **candidate endpoints** from the EPP and is responsible for selecting a match.
113+
114+
The reference scheduler is **informed** about the current state of model servers via **informers**, of which the current informer is a fast-polling loop retrieving model server metrics via the [model server protocol](../003-model-server-protocol/).
115+
116+
The reference scheduler is configured with a series of **predicates** that **filter** candidate endpoints, removing impossible matches. If no matches or only one match is feasible, that endpoint is selected. If multiple matches are made, the scheduler will consult a list of configured **scorers** to **score** the matches into a **prioritized** list of endpoints, and then **sample** from that list.
117+
118+
Once an endpoint is selected, the endpoint is **assumed** to be running that request until the EPP observes the termination of that request (most common) OR an informer invalidates the execution of those requests. The scheduler must integrate the impact of assumed load to with informer state, especially when traffic spikes.
119+
120+
Given that we anticipate a significant amount of future work to integrate heterogenous hardware (different generations / topologies) and heterogeous server roles (prefill-heavy, prefill/decode split, latency objectives), we expect that there will be an **assignment** informer that partitions the candidate endpoints over multiple dimensions for the scheduler. This will decouple the scheduling algorithm from the process of determining the capacity and suitability of different model servers to different dimensions of request cost.
121+
122+
#### Replacement Scheduler
123+
124+
The replacement scheduler will be a low-latency mechanism for out-of-process execution of the core endpoint selection option. The replacement scheduler will accept one or more requests to schedule, a list of endpoints, and optionally the associated informer state for those endpoints. The replacement scheduler will return one or zero endpoints per request.
125+
126+
#### Scheduler Validation
127+
128+
The proper functioning of the scheduler to prevent regression of performance is critical. A multi-level test strategy will be required:
129+
130+
- Unit tests that verify scheduling decisions are accurate for all predictates and scorers
131+
- Integration tests that verify concurrent execution as well as cooperative scheduling
132+
- End to end tests that verify production traces against default scheduling achieve specific behavior
133+
134+
A benchmarking harness will be provided to capture and reproduce a production trace, primarily to aid algorithmic contributors. A small but diverse set of production traces will be used initially to anchor expectations, and scaling both the number of supported traces and efficient regression testing at scale will be critical.
135+
136+
We anticipate that accelerator availability will limit the scale of e2e testing and contribution. We will develop a **model server stub** that can emulate the behavior of the core expected algorithm for model servers and does not require accelerators. We will support both time-accurate and configurable ratio emulation to allow fast execution.
137+
138+
### Alternatives
139+
140+
#### Replaceable but not extensible scheduler
141+
142+
A non-extensible scheduler would be a black-box that could be replaced, and would be ideal if we do not intend the reference implementation to be featureful or if there is no wide set of scheduler features valuable to many users.
143+
144+
Given that we desire to have a strong out of the box reference implementation that improves performance for many users with no configuration, we do not select this alternative.
145+
146+
#### Highly-parameterizable scheduler
147+
148+
A parameterizable scheduler would have a rich configuration syntax exposed to InferencePool admins (and potentially InferenceModel users). It would be ideal if most inference workloads had no similarities and every workload needed to be configured at the pool level or higher.
149+
150+
Given that we desire to have a strong reference implementation that improves performance for many users with no out of the box configuration, and that we desire to have many implementations able to directly consume the InferenceModel and InferencePool APIs, we at this time recommend not exposing full configurability of the extension via the Inference* APIs (collectively referred to as Model Routing APIs). Instead, we recommend that algorithms be configurable either by parameterization to the EPP until we have clear design evidence for a need to add new CRDs. At that time, in keeping with the project principles around API extension, we will reassess.

0 commit comments

Comments
 (0)
Please sign in to comment.