Documentation
¶
Overview ¶
Package ordering provides the standard implementations of the OrderingPolicy interface.
Context: The 3-Tier Dispatch Hierarchy ¶
The Flow Control system manages traffic using a strict three-tier decision hierarchy. This package implements Tier 3.
Priority (Band Selection): The system first strictly selects the highest-priority Band that has pending work.
Fairness (Flow Selection): Once a Band is selected, the FairnessPolicy (interflow) determines which Flow within that band gets the next dispatch opportunity.
Ordering (Item Selection) - [THIS PACKAGE]: Once a Flow is selected, the OrderingPolicy determines which Request from that specific flow's queue is dispatched. This governs the "internal discipline" of the flow (e.g., whether to serve oldest requests first or most urgent).
Architecture: The Flyweight Pattern ¶
Ordering Policies are Singletons. A single instance handles the ordering logic for all queues in a Priority Band. To support this efficiently, the policy follows the Flyweight pattern:
- The Plugin Instance (e.g., FCFS) is a Singleton. It defines the Logic (Less).
- The Logic (Less) acts as a pure function (or comparator) that operates on the queue's items.
Standard Implementations ¶
This package includes the following core strategies:
FCFS ("First-Come, First-Served") ("fcfs-ordering-policy"): Orders requests by their logical arrival time. This is the default and most "intuitive" ordering.
EDF ("Earliest Deadline First") ("edf-ordering-policy"): Orders requests by their absolute deadline (EnqueueTime + TTL). This maximizes the number of requests served before their deadlines expire.
SLO Deadline ("slo-deadline-ordering-policy"): Orders requests by an SLO-based (service level objective) deadline computed as ReceivedTimestamp + x-llm-d-slo-ttft-ms header (interpreted as milliseconds). Requests without a valid header are scheduled after SLO-bound requests. This maximizes the number of requests served before the deadlines computed on the defined SLO expire.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package edf implements an ordering policy that selects requests based on their absolute deadlines (Earliest Deadline First).
|
Package edf implements an ordering policy that selects requests based on their absolute deadlines (Earliest Deadline First). |
|
Package fcfs implements an ordering policy that selects requests based on their arrival order at the Flow Control layer (First-Come, First-Served).
|
Package fcfs implements an ordering policy that selects requests based on their arrival order at the Flow Control layer (First-Come, First-Served). |
|
Package slodeadline implements an ordering policy that selects requests based on an SLO-based deadline derived from request headers.
|
Package slodeadline implements an ordering policy that selects requests based on an SLO-based deadline derived from request headers. |