concurrency

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

README

Concurrency Attributes

This package defines the data structures for tracking real-time concurrency and load on endpoints.

InFlightLoad

Captures the current real-time load of an endpoint as tracked by the EPP.

  • Key: InFlightLoadDataKey
  • Fields:
    • Tokens: Number of tokens currently in-flight.
    • Requests: Number of requests currently in-flight.

Producers

The following plugins produce this attribute:

  • inflight-load-producer (Request Control): Tracks real-time token and request counters as they are dispatched and completed by the EPP.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InFlightLoadDataKey = plugin.NewDataKey("InFlightLoadDataKey", inflightloadconstants.InFlightLoadProducerType)

InFlightLoadDataKey carries the per-endpoint in-flight load snapshot used by load-aware scorers. Populated by InFlightLoadProducer.Produce on each candidate endpoint at the start of every scheduling cycle.

Represents the live, real-time load on the endpoint (tokens and requests), injected dynamically and never overwritten during a scheduling cycle.

View Source
var UncachedRequestTokensDataKey = plugin.NewDataKey("UncachedRequestTokensDataKey", inflightloadconstants.InFlightLoadProducerType)

UncachedRequestTokensDataKey carries the projected impact of the current request on a specific endpoint. Populated statically during scheduling.

Functions

This section is empty.

Types

type InFlightLoad

type InFlightLoad struct {
	// Tokens is the in-flight token count this endpoint has committed to,
	// accumulated from past scheduling decisions. Updated by PreRequest (when
	// an endpoint is chosen) and OnEvicted (when its request stream ends);
	// snapshotted into this struct each cycle by InFlightLoadProducer.Produce.
	Tokens int64

	// Requests is the in-flight request count this endpoint has committed to,
	// maintained with the same lifecycle as Tokens.
	Requests int64
}

InFlightLoad captures the current real-time load of an endpoint as tracked by the EPP.

func (*InFlightLoad) Clone

func (l *InFlightLoad) Clone() fwkdl.Cloneable

Clone returns an independent copy of the InFlightLoad. The value-copy idiom (cp := *l) covers every field automatically; new fields added to InFlightLoad do not require updating Clone, as long as they remain value types (no slices, maps, or pointers requiring deep copy).

type UncachedRequestTokens

type UncachedRequestTokens struct {
	// Tokens is a speculative projection: the work the request currently being
	// scheduled would add to this endpoint if it landed here. Includes the
	// uncached input portion (accounting for prefix-cache hits) plus the
	// estimated output when the producer is configured with
	// AddEstimatedOutputTokens=true. Computed fresh by Produce on every cycle
	// from the request being scored and this endpoint's prefix-cache state;
	// never committed to endpoint state and not decremented on stream end.
	// Zero when no request is in scope (e.g., background snapshots).
	Tokens int64
}

UncachedRequestTokens represents the projected impact of the current request on a specific endpoint, populated statically during scheduling.

func (*UncachedRequestTokens) Clone

Clone returns an independent copy of the UncachedRequestTokens.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL