common

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AutoscalingLabelPrefix = "autoscaling.aibrix.ai/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseScalingContext

type BaseScalingContext struct {
	// Maximum rate at which to scale up
	MaxScaleUpRate float64
	// Maximum rate at which to scale down, a value of 2.5 means the count can reduce to at most 2.5 times less than the current value in one step.
	MaxScaleDownRate float64
	// The metric used for scaling, i.e. CPU, Memory, QPS.
	ScalingMetric string
	// The value of scaling metric per pod that we target to maintain.
	TargetValue float64
	// The total value of scaling metric that a pod can maintain.
	TotalValue float64
	// contains filtered or unexported fields
}

BaseScalingContext provides a base implementation of the ScalingContext interface.

func NewBaseScalingContext

func NewBaseScalingContext() *BaseScalingContext

NewBaseScalingContext creates a new instance of BaseScalingContext with default values.

func (*BaseScalingContext) GetCurrentUsePerPod

func (b *BaseScalingContext) GetCurrentUsePerPod() float64

func (*BaseScalingContext) GetDownFluctuationTolerance

func (b *BaseScalingContext) GetDownFluctuationTolerance() float64

func (*BaseScalingContext) GetMaxScaleDownRate

func (b *BaseScalingContext) GetMaxScaleDownRate() float64

func (*BaseScalingContext) GetMaxScaleUpRate

func (b *BaseScalingContext) GetMaxScaleUpRate() float64

func (*BaseScalingContext) GetScalingTolerance

func (b *BaseScalingContext) GetScalingTolerance() (up float64, down float64)

func (*BaseScalingContext) GetTargetValue

func (b *BaseScalingContext) GetTargetValue() float64

func (*BaseScalingContext) GetUpFluctuationTolerance

func (b *BaseScalingContext) GetUpFluctuationTolerance() float64

func (*BaseScalingContext) SetCurrentUsePerPod

func (b *BaseScalingContext) SetCurrentUsePerPod(value float64)

func (*BaseScalingContext) UpdateByPaTypes

UpdateByPaTypes should be invoked in any scaling context that embeds BaseScalingContext.

type ScalingContext

type ScalingContext interface {
	GetTargetValue() float64
	GetUpFluctuationTolerance() float64
	GetDownFluctuationTolerance() float64
	GetMaxScaleUpRate() float64
	GetMaxScaleDownRate() float64
	GetCurrentUsePerPod() float64
	UpdateByPaTypes(pa *autoscalingv1alpha1.PodAutoscaler) error
}

ScalingContext defines the generalized common that holds all necessary data for scaling calculations.

Jump to

Keyboard shortcuts

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