lbbr

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LBBR

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

LBBR implements Bottleneck Bandwidth and Round-trip propagation time limiter.

func NewLimiter

func NewLimiter(opts ...Option) *LBBR

NewLimiter returns a L-BBR limiter

func (*LBBR) Allow

func (l *LBBR) Allow() (ratelimiter.DoneFunc, error)

Allow checks all inbound traffic. Once overload is detected, it raises limit.ErrLimitExceed error.

func (*LBBR) Stat

func (l *LBBR) Stat() Stat

Stat tasks a snapshot of the L-BBR limiter.

type Option

type Option func(*options)

Option function for L-BBR limiter

func WithBucket

func WithBucket(b int) Option

WithBucket with bucket ize.

func WithCPUQuota

func WithCPUQuota(quota float64) Option

WithCPUQuota with real cpu quota(if it can not collect from process correct);

func WithCPUThreshold

func WithCPUThreshold(threshold int64) Option

WithCPUThreshold with cpu threshold;

func WithWindow

func WithWindow(d time.Duration) Option

WithWindow with window size.

type Stat

type Stat struct {
	CPU         int64
	InFlight    int64
	MaxInFlight int64
	MinRt       int64
	MaxPass     int64
}

Stat contains the metrics snapshot of L-BBR.

Jump to

Keyboard shortcuts

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