Documentation
¶
Overview ¶
Package requestcontrol contains helpers to decouple latency-predictor logic.
running_request_tpot_slo_queue.go tracks in-flight requests per endpoint, ordered by their TPOT SLO. This allows the predictor to quickly determine the tightest (minimum) TPOT SLO among all running requests on an endpoint, which is used as input to the latency prediction model. The count of running requests is also used by the scorer for idle pod detection.
Requests are added in PreRequest (after scheduling) and removed in ResponseBody at EOS or on TTL eviction.
Index ¶
- Constants
- Variables
- func PredictedLatencyFactory(name string, rawParameters *json.Decoder, handle plugin.Handle) (plugin.Plugin, error)
- type Config
- type PredictedLatency
- func (pl *PredictedLatency) Consumes() plugin.DataDependencies
- func (pl *PredictedLatency) PreRequest(ctx context.Context, request *fwksched.InferenceRequest, ...)
- func (pl *PredictedLatency) Produce(ctx context.Context, request *fwksched.InferenceRequest, ...) error
- func (pl *PredictedLatency) Produces() map[plugin.DataKey]any
- func (pl *PredictedLatency) ResponseBody(ctx context.Context, request *fwksched.InferenceRequest, ...)
- func (pl *PredictedLatency) ResponseHeader(ctx context.Context, request *fwksched.InferenceRequest, ...)
- func (pl *PredictedLatency) TypedName() plugin.TypedName
Constants ¶
const ( // LatencyDataProviderPluginType is the plugin type for the latency predictor. // It trains XGBoost models via the sidecar and generates predictions for scoring. LatencyDataProviderPluginType = latencyproducerconstants.LatencyDataProviderPluginType // TTFTSLOHeaderKey is the header key for the TTFT SLO. TTFTSLOHeaderKey = metadata.TTFTSLOHeaderKey // TPOTSLOHeaderKey is the header key for the TPOT SLO. TPOTSLOHeaderKey = metadata.TPOTSLOHeaderKey // ExperimentalDefaultPrefillProfile is the default profile name for prefill endpoints in disaggregated serving. ExperimentalDefaultPrefillProfile = "prefill" )
Variables ¶
Functions ¶
Types ¶
type Config ¶
type Config struct {
SamplingMean float64 `json:"samplingMean,omitempty"`
MaxDecodeTokenSamplesForPrediction int `json:"maxDecodeTokenSamplesForPrediction,omitempty"`
SLOBufferFactor float64 `json:"sloBufferFactor,omitempty"`
ContextTTL time.Duration `json:"contextTTL,omitempty"`
StreamingMode bool `json:"streamingMode,omitempty"`
EndpointRoleLabel string `json:"endpointRoleLabel,omitempty"`
// PredictInProduce controls whether bulk predictions are generated during
// Produce. Set to false to disable predictions (training-only mode).
// When false, the predictor still collects training data but does not call the
// sidecar for predictions. Default: true.
PredictInProduce bool `json:"predictInProduce,omitempty"`
PrefixMatchInfoProducerName string `json:"prefixMatchInfoProducerName,omitempty"`
}
type PredictedLatency ¶
type PredictedLatency struct {
// contains filtered or unexported fields
}
PredictedLatency is the latency data provider plugin. It handles:
- Produce: bulk predictions via the latency predictor sidecar
- PreRequest: dispatch-time bookkeeping (token counters, request queues)
- ResponseHeader/ResponseBody: training data collection (TTFT/TPOT)
- Produces/Consumes: endpoint attribute declarations
Scoring, picking, and admission are handled by separate sub-plugins: LatencyScorer, AffinityWeightedPicker, and LatencyAdmission.
func NewPredictedLatency ¶
func NewPredictedLatency(name string, config Config, predictor latencypredictor.PredictorInterface) *PredictedLatency
func (*PredictedLatency) Consumes ¶
func (pl *PredictedLatency) Consumes() plugin.DataDependencies
func (*PredictedLatency) PreRequest ¶
func (pl *PredictedLatency) PreRequest(ctx context.Context, request *fwksched.InferenceRequest, schedulingResult *fwksched.SchedulingResult)
func (*PredictedLatency) Produce ¶
func (pl *PredictedLatency) Produce(ctx context.Context, request *fwksched.InferenceRequest, endpoints []fwksched.Endpoint) error
Produce prepares the SLO context for the request, including parsing SLO headers, gathering prefix cache scores, and generating predictions.
func (*PredictedLatency) ResponseBody ¶
func (pl *PredictedLatency) ResponseBody(ctx context.Context, request *fwksched.InferenceRequest, response *requestcontrol.Response, targetMetadata *fwkdl.EndpointMetadata)
ResponseBody handles both per-chunk processing and request completion logic.
func (*PredictedLatency) ResponseHeader ¶
func (pl *PredictedLatency) ResponseHeader(ctx context.Context, request *fwksched.InferenceRequest, response *requestcontrol.Response, targetMetadata *fwkdl.EndpointMetadata)
func (*PredictedLatency) TypedName ¶
func (pl *PredictedLatency) TypedName() plugin.TypedName