nextgc

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

Documentation

Overview

Package nextgc provides the implementation of memory usage controller, which aims to keep Go Runtime NextGC value lower than the RSS consumption hard limit to prevent OOM errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewControllerFromConfig

func NewControllerFromConfig(
	logger logr.Logger,
	cfg *ControllerConfig,
	serviceStatsSubscription stats.ServiceStatsSubscription,
	backpressureOperator backpressure.Operator,
) (controller.Controller, error)

NewControllerFromConfig builds new controller.

Types

type ComponentProportionalConfig

type ComponentProportionalConfig struct {
	// Coefficient - coefficient used to computed weighted sum of in the controller equation
	Coefficient float64 `json:"coefficient"`
	// WindowSize - averaging window size for the EMA. Averaging is disabled if WindowSize is zero.
	WindowSize uint `json:"window_size"`
}

ComponentProportionalConfig - controller's proportional component configuration.

func (*ComponentProportionalConfig) Prepare

func (c *ComponentProportionalConfig) Prepare() error

Prepare - config validator.

type ControllerConfig

type ControllerConfig struct {
	// RSSLimit - physical memory (RSS) consumption hard limit for a process.
	RSSLimit bytes.Bytes `json:"rss_limit"`
	// DangerZoneGOGC - RSS utilization threshold that triggers controller to
	// set more conservative parameters for GC.
	// Possible values are in range (0; 100).
	DangerZoneGOGC uint32 `json:"danger_zone_gogc"`
	// DangerZoneGOGC - RSS utilization threshold that triggers controller to
	// throttle incoming requests.
	// Possible values are in range (0; 100).
	DangerZoneThrottling uint32 `json:"danger_zone_throttling"`
	// Period - the periodicity of control parameters computation.
	Period duration.Duration `json:"period"`
	// ComponentProportional - controller's proportional component configuration
	ComponentProportional *ComponentProportionalConfig `json:"component_proportional"`
}

ControllerConfig - controller configuration.

func (*ControllerConfig) Prepare

func (c *ControllerConfig) Prepare() error

Prepare - config validator.

Jump to

Keyboard shortcuts

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