remote

package
v0.0.0-...-43b7830 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QPSMeterTickDuration = time.Second
	QPSMeterBucketLen    = 3

	InflightMeterBucketLen      = 6
	InflightMeterBucketDuration = time.Millisecond * 200
)
View Source
const (
	MaxIdealDuration    = time.Millisecond * 900
	MaxLimitRequestQPS  = 200
	LimitRequestTimeout = time.Millisecond * 290
)
View Source
const (
	LimiterReconcilePeriod = time.Second * 2
)

Variables

View Source
var (
	GlobalTokenBucketBurstPercent         = int32(5)
	GlobalTokenBucketBurstMinTokens       = int32(1)
	GlobalTokenBucketBatchAcquiredPercent = int32(10)
	GlobalTokenBucketBatchAcquireMin      = int32(1)

	GlobalMaxInflightBurstPercent        = int32(2)
	GlobalMaxInflightBurstMinInflight    = int32(1)
	GlobalMaxInflightBatchAcquirePercent = int32(20)
	GlobalMaxInflightBatchAcquireMin     = int32(1)
)

Functions

func EnableGlobalFlowControl

func EnableGlobalFlowControl(schema proxyv1alpha1.FlowControlSchema) bool

Types

type AcquireResult

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

type CounterFun

type CounterFun func(int32)

type FlowControlCache

type FlowControlCache interface {
	FlowControl() RemoteFlowControlWrapper
	EnableRemoteFlowControl()
	LocalFlowControl() LocalFlowControlWrapper
	Strategy() proxyv1alpha1.LimitStrategy
	Rate() float64
	Inflight() float64
	MaxInflight() int32
	Stop()
}

func NewFlowControlCache

func NewFlowControlCache(cluster, name, clientID string, globalCounterProvider GlobalCounterProvider) FlowControlCache

type FlowControlMap

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

func NewFlowControlsMap

func NewFlowControlsMap() *FlowControlMap

func (*FlowControlMap) Delete

func (f *FlowControlMap) Delete(name string)

func (*FlowControlMap) Len

func (f *FlowControlMap) Len() int

func (*FlowControlMap) Load

func (f *FlowControlMap) Load(name string) (FlowControlCache, bool)

func (*FlowControlMap) Snapshot

func (f *FlowControlMap) Snapshot() map[string]FlowControlCache

func (*FlowControlMap) Store

func (f *FlowControlMap) Store(name string, fl FlowControlCache)

type GlobalCounter

type GlobalCounter interface {
	Count(int32)
}

type GlobalCounterFlowControl

type GlobalCounterFlowControl interface {
	flowcontrol.FlowControl
	SetLimit(result *AcquireResult) bool
	ExpectToken() int32
	AddAcquiring(n int32)
	CurrentToken() int32
}

type GlobalCounterProvider

type GlobalCounterProvider interface {
	Add(name string, typ proxyv1alpha1.FlowControlSchemaType, flowControl RemoteFlowControlWrapper) GlobalCounter
	Get(name string) GlobalCounter
	Stop(name string)
}

func NewGlobalCounterProvider

func NewGlobalCounterProvider(ctx context.Context, cluster string, clientSets clientsets.ClientSets, clientID string) GlobalCounterProvider

type LocalFlowControlWrapper

type LocalFlowControlWrapper interface {
	flowcontrol.FlowControl
	Sync(proxyv1alpha1.FlowControlSchema)
	Config() proxyv1alpha1.FlowControlSchema
}

type Reconcile

type Reconcile interface {
	EnsureReconcile(rateLimiter string)
}

func NewReconcile

func NewReconcile(ctx context.Context, cluster string, clientSets clientsets.ClientSets, flowControls *FlowControlMap) Reconcile

type RemoteFlowControlWrapper

type RemoteFlowControlWrapper interface {
	GlobalCounterFlowControl
	Sync(proxyv1alpha1.RateLimitItemConfiguration)
	Config() proxyv1alpha1.RateLimitItemConfiguration
	Done() <-chan struct{}
}

Jump to

Keyboard shortcuts

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