backpressure

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package backpressure contains code applying control signals issued by controller to Go runtime and and to gRPC server.

Index

Constants

View Source
const (
	// DefaultGOGC - default GOGC value.
	DefaultGOGC = 100
	// NoThrottling - allow execution of all GRPC requests.
	NoThrottling = 0
	// FullThrottling - a complete ban on GRPC request execution.
	FullThrottling = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Operator

type Operator interface {
	// SetControlParameters registers the actual value of control parameters.
	SetControlParameters(value *stats.ControlParameters) error
	// AllowRequest can be used by server middleware to check if it's possible to execute
	// a particular request.
	AllowRequest() bool
	// GetStats returns statistics of Backpressure subsystem.
	GetStats() (*stats.BackpressureStats, error)
}

Operator applies control signals to Go runtime and GRPC server.

func NewOperator

func NewOperator(logger logr.Logger, options ...Option) Operator

NewOperator builds new Operator.

type OperatorMock

type OperatorMock struct {
	Operator
	mock.Mock
}

func (*OperatorMock) SetControlParameters

func (m *OperatorMock) SetControlParameters(value *stats.ControlParameters) error

type Option added in v0.0.2

type Option interface {
	// contains filtered or unexported methods
}

Option - backpressure operator options.

func WithNotificationsOption added in v0.0.2

func WithNotificationsOption(notifications chan<- *stats.MemLimiterStats) Option

WithNotificationsOption makes it possible for a client to implement application-specific backpressure logic. Client may subscribe for the operative MemLimiter telemetry and make own decisions (taking into account metrics like RSS etc.). This is inspired by the channel that was attached to SetMaxHeap function (see https://github.com/golang/proposal/blob/master/design/48409-soft-memory-limit.md#setmaxheap)

Jump to

Keyboard shortcuts

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