Skip to content

[Feature]: make cache-aware routing engine-pressure aware #11

Description

@DavidBellamy

Problem Statement

The cache_aware policy measures worker load with a gateway-local active request count. A short request and a very long prompt or reasoning decode each add one, even though their compute and KV-cache pressure differ by orders of magnitude. Cache affinity can therefore route into a hot worker.

Proposed Solution

Feed existing WorkerLoadResponse snapshots into cache_aware routing and add request token-cost reservations. Prefer cache locality only when the cache candidate remains within configurable engine-pressure bounds. Support shadow decisions, telemetry freshness checks, and consistent fallback when engine load is unavailable.

Alternatives Considered

Using power_of_two discards cache affinity. Using only token_usage reacts after engine polling and does not protect against bursts between polls. Moving routing into the caller duplicates gateway behavior.

Feature Area

Routing & Load Balancing

Affected Components

model-gateway, protocols, python-bindings

Use Case

Shared inference replicas receive heterogeneous prompt and output lengths. Routing must account for projected KV occupancy and observed queue or scheduler pressure while retaining prefix-cache benefits when safe.

Priority to You

Critical / Blocking

Contribution

  • I am willing to contribute this feature (with guidance)
  • I am willing to help test this feature
  • I can provide more detailed requirements if needed

Acceptance Criteria

  • cache_aware consumes fresh engine load snapshots.
  • request reservations cover the interval between selection and engine observation.
  • cache affinity is bounded by configurable pressure limits.
  • stale or partial telemetry falls back consistently.
  • shadow mode records current and proposed selections.
  • unit and integration tests cover heterogeneous requests, overload, and stream cleanup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions