You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/proposals/0845-scheduler-architecture-proposal/README.md
+25-15Lines changed: 25 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,13 +14,22 @@ The Scheduling Subsystem is a framework used to implement scheduling algorithms.
14
14
- The entry & exit points should be defined by the framework, acting as the API surface of the system
15
15
- Multiple scheduling 'profiles' should be able to be ran for a single request.
16
16
- They can be conditionally dependent on previous runs, or in parallel
17
-
- Plugin state is managed by the plugin itself
17
+
- State management
18
+
- State per request: This is managed by what we are calling CycleState and its lifecycle is tied to the request.
19
+
Cycle state is created internally by the Scheduler per request and its pointer is passed as argument.
20
+
- State managed by the plugin struct itself: The lifecycle of this state is tied to the plugin, and since plugins will be instantiated once,
21
+
it is a state that plugins can use across requests (like prefix-cache index).
22
+
- State managed by the data layer: each endpoint will be associated with state (currently metrics) that a data layer plugin can add to it.
23
+
A data layer plugin could be one that scrapes v1/models from the endpoint for example.
18
24
19
25
## Definitions
20
26
-**Scheduling Framework** - The system created to allow for a pluggable scheduling algorithm.
21
-
-**Scheduling Profile** - A named, specific set of Filter(s), Scorer(s), & Picker used to select endpoints.
22
-
-**Scheduler** - An extensible implementation of a scheduling algorithm. Including logic to select Scheduling Profiles, the Scheduling Profiles themselves, & logic to interpret the result.
23
-
-**Scheduling Cycle** - A single run of a Scheduler through the Scheduling Framework.
27
+
-**Scheduler Profile** - A named, specific set of Filter(s), Scorer(s), & Picker used to select endpoints.
28
+
-**Scheduler Profile Run** - a one time run of the Scheduler Profile filters, scorers and picker given a request.
29
+
-**Scheduler** - An extensible implementation of a scheduling algorithm. Including logic to select Scheduler Profiles iteratively,
30
+
the Scheduler Profiles themselves, & logic to interpret the result.
31
+
-**Scheduling Cycle** - A single run of a Scheduler through the Scheduling Framework. a scheduling cycle includes one or
32
+
more Scheduler Profile runs (at least one).
24
33
-**Plugin** - Implementation of framework-defined interface(s) to add or extend logic across the framework.
25
34
26
35
## Proposal
@@ -33,23 +42,24 @@ The Scheduling System can loosely be defined into 3 sections:
33
42
- A *configuration API* to define the Scheduler, Profile(s), & the plugins used within those profiles
34
43
35
44
A sketch of the System, with extension points is here:
Describing the interface extension points & flow is the simplest way to convey the intent of what the framework should enable:
39
48
40
-
### PreSchedule
49
+
### ProfileSelect (or ProfilePick)
41
50
42
-
PreSchedule is the entry point into the scheduling cycle (called by the framework). PreSchedule, selects profiles conditionally based on:
51
+
ProfilePick is the entry point into the scheduling cycle (called by the framework).
52
+
ProfileSelect, selects profiles conditionally based on:
43
53
44
54
- Request data
45
-
- Results
55
+
- Results of previously executed SchedulerProfiles
46
56
- Cycle State
47
57
48
-
PreSchedule will be continuously called so long as profiles are returned; multiple profiles may be returned in a single call. Only a single PreSchedule function may be defined per scheduler.
58
+
ProfileSelect will be continuously called so long as profiles are returned; multiple profiles may be returned in a single call. Only a single ProfileSelect function may be defined per scheduler.
49
59
50
-
### Profile Cycle
60
+
### Scheduler Profile Run
51
61
52
-
The profile cycle consists of 3 defined functions`Filter`, `Score`, & `Pick`
62
+
The SchedulerPprofile run consists of 3 defined phases`Filter`, `Score`, & `Pick`
53
63
54
64
*Profile Constraints*
55
65
- A profile can have any number of `Filter` plugins registered (including zero)
@@ -61,16 +71,16 @@ The profile cycle consists of 3 defined functions `Filter`, `Score`, & `Pick`
61
71
Filter runs before any scoring, and remove endpoints that are not fit for selection. The framework will return an error to the client if the endpoints are filtered to zero.
62
72
63
73
#### Score
64
-
Score applies a score to each remaining endpoint provided. Scorers SHOULD keep their score values in a normalized range: [0-1]. Any weighting should be added at the SchedulingProfile configuration level.
74
+
Score applies a score to each remaining endpoint provided. Scorers SHOULD keep their score values in a normalized range: [0-1]. Any weighting should be added at the SchedulerProfile configuration level.
65
75
66
76
#### Pick
67
77
Picker selects the endpoint(s) from the provided list of scored endpoints. Picker MUST return, one endpoint at minimum.
68
78
69
79
70
-
### PostSchedule
71
-
PostSchedule receives the output of the result(s) of the scheduling cycle(s) and makes sense of the data to be consumed by the calling system.
80
+
### ProcessProfilesResults
81
+
ProcessProfilesResults recieves the output of the result(s) of the scheduler profile(s) and makes sense of the data to be consumed by the calling system.
72
82
73
-
### PostResponse
83
+
### PostResponse (Out of Scheduler and mentioned here for completeness only)
74
84
PostResponse is a special case extension that can optionally be implemented by a plugin that needs to augment its state based on response or request data. This should only be implemented for plugins that need to update state outside of the scheduling cycle. PostResponse is ran at the time of processing a response.
0 commit comments