kvcacheutilization

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: 5 Imported by: 0

README

KV Cache Utilization Scorer Plugin

Type: kv-cache-utilization-scorer

This plugin scores candidate endpoints using each endpoint's current KV-cache utilization.

What it does

For each candidate endpoint, the plugin computes:

  {score(endpoint)} = 1 - {kvCacheUsagePercent}

Where kvCacheUsagePercent is read from endpoint metrics.

This means:

  • lower KV-cache usage -> higher score
  • higher KV-cache usage -> lower score

Scheduling intent

The scorer returns category Distribution, so it helps spread traffic away from endpoints with high KV-cache pressure.

Inputs consumed

The plugin consumes:

  • metrics.KVCacheUsagePercentKey (float64)

Configuration

This scorer currently has no runtime parameters.

Configuration Example:

plugins:
  - type: kv-cache-utilization-scorer
    name: kv-cache-util
schedulingProfiles:
  - name: default
    plugins:
      - pluginRef: kv-cache-util
        weight: 1

Documentation

Index

Constants

View Source
const (
	KvCacheUtilizationScorerType = "kv-cache-utilization-scorer"
)

Variables

This section is empty.

Functions

func KvCacheUtilizationScorerFactory

func KvCacheUtilizationScorerFactory(name string, _ *json.Decoder, _ fwkplugin.Handle) (fwkplugin.Plugin, error)

KvCacheUtilizationScorerFactory defines the factory function for KVCacheUtilizationScorer.

Types

type KVCacheUtilizationScorer

type KVCacheUtilizationScorer struct {
	// contains filtered or unexported fields
}

KVCacheUtilizationScorer scores list of candidate endpoints based on KV cache utilization.

func NewKVCacheUtilizationScorer

func NewKVCacheUtilizationScorer() *KVCacheUtilizationScorer

NewKVCacheUtilizationScorer initializes a new KVCacheUtilizationScorer and returns its pointer.

func (*KVCacheUtilizationScorer) Category

Category returns the preference the scorer applies when scoring candidate endpoints.

func (*KVCacheUtilizationScorer) Consumes

func (s *KVCacheUtilizationScorer) Consumes() map[string]any

Consumes returns the list of data that is consumed by the plugin.

func (*KVCacheUtilizationScorer) Score

Score returns the scoring result for the given list of endpoints based on context.

func (*KVCacheUtilizationScorer) TypedName

TypedName returns the type and name tuple of this plugin instance.

func (*KVCacheUtilizationScorer) WithName

WithName sets the name of the scorer.

Jump to

Keyboard shortcuts

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