xdscapacity

package
v1.16.109 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StatsGauges = []prometheus.GaugeDefinition{
	{
		Name: []string{"xds", "server", "idealStreamsMax"},
		Help: "The maximum number of xDS streams per server, chosen to achieve a roughly even spread of load across servers.",
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	Logger         hclog.Logger
	GetStore       func() Store
	SessionLimiter SessionLimiter
}

Config contains the dependencies for Controller.

type Controller

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

Controller determines the ideal number of xDS streams for the server to handle and enforces it using the given SessionLimiter.

We aim for a roughly even spread of streams between servers in the cluster and, to that end, limit the number of streams each server can handle to:

(<number of proxies> / <number of healthy servers>) + <error margin>

Controller receives changes to the number of healthy servers from the autopilot delegate. It queries the state store's catalog tables to discover the number of registered proxy (sidecar and gateway) services.

func NewController

func NewController(cfg Config) *Controller

NewController creates a new capacity controller with the given config.

Call Run to start the control-loop.

func (*Controller) Run

func (c *Controller) Run(ctx context.Context)

Run the control-loop until the given context is canceled or reaches its deadline.

func (*Controller) SetServerCount

func (c *Controller) SetServerCount(count uint32)

SetServerCount updates the number of healthy servers that is used when determining capacity. It is called by the autopilot delegate.

type SessionLimiter

type SessionLimiter interface {
	SetMaxSessions(maxSessions uint32)
	SetDrainRateLimit(rateLimit rate.Limit)
}

SessionLimiter is used to enforce the session limit to achieve the ideal spread of xDS streams between servers.

type Store

type Store interface {
	AbandonCh() <-chan struct{}
	ServiceUsage(ws memdb.WatchSet) (uint64, structs.ServiceUsage, error)
}

Jump to

Keyboard shortcuts

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