resizer

package
v0.0.0-...-a69e935 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewResizer

func NewResizer(
	manager manager.HostPoolManager,
	cqosClient cqos.QoSAdvisorServiceYARPCClient,
	hostMover hostmover.HostMover,
	config Config,
	scope tally.Scope,
) *resizer

NewResizer creates a new resizer instance.

Types

type Config

type Config struct {
	// Interval at which resizer runs.
	ResizeInterval time.Duration
	// The number of hosts to be moved across pools as part of one resize operation.
	MoveBatchSize uint32

	// Threshold for cqos score per host after which the host is considered hot.
	CqosThresholdPerHost uint32

	// PoolResizeRange contains the range of number of hot hosts such that that
	// helps the resizer decide when to lend or borrow hosts for this pool.
	PoolResizeRange PoolResizeRange

	// Minimum time for which a pool should stay in hot/cold state before it is
	// resized. This will be used to avoid host moves if a pool fluctuates
	// between hot/cold state frequently.
	MinWaitBeforeResize time.Duration
}

type Metrics

type Metrics struct {

	// MoveScope is used to emit host move metrics per pool.
	RootScope tally.Scope
	MoveScope tally.Scope

	// metrics.
	GetPool        tally.Counter
	GetPoolFail    tally.Counter
	MoveHosts      tally.Counter
	MoveHostsFail  tally.Counter
	GetMetrics     tally.Counter
	GetMetricsFail tally.Counter

	// Resizer run duration for one run.
	ResizerRunDuration tally.Timer
}

func NewMetrics

func NewMetrics(scope tally.Scope) *Metrics

type PoolResizeRange

type PoolResizeRange struct {
	Lower uint32
	Upper uint32
}

PoolResizeRange contains the range of number of hot hosts such that that helps the resizer decide when to lend or borrow hosts for this pool. Lower: if the number of hot hosts in the pool are <= Lower, the pool can lend hosts. Upper: if the number of hot hosts in the pool are > Upper, the pool needs to borrow hosts. If the number of hot hosts fall within the upper and lower limits, the pool is considered at risk of getting hot, and should not give back borrowed hosts.

type PoolStatus

type PoolStatus int
const (
	NeedHosts PoolStatus = iota + 1
	OptimumHosts
	ExcessHosts
)

Jump to

Keyboard shortcuts

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