loadbalance

package
v3.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2021 License: Apache-2.0 Imports: 18 Imported by: 119

Documentation

Index

Constants

View Source
const (
	// ConsistentHash consistent hash
	ConsistentHash = "consistenthash"
	// HashNodes hash nodes
	HashNodes = "hash.nodes"
	// HashArguments key of hash arguments in url
	HashArguments = "hash.arguments"
)
View Source
const (
	// RoundRobin load balancing way
	RoundRobin = "roundrobin"

	// nolint
	COMPLETE = 0
	// nolint
	UPDATING = 1
)
View Source
const (
	// LeastActive is used to set the load balance extension
	LeastActive = "leastactive"
)

Variables

This section is empty.

Functions

func GetWeight

func GetWeight(invoker protocol.Invoker, invocation protocol.Invocation) int64

GetWeight gets weight for load balance strategy

func NewConsistentHashLoadBalance

func NewConsistentHashLoadBalance() cluster.LoadBalance

NewConsistentHashLoadBalance creates NewConsistentHashLoadBalance

The same parameters of the request is always sent to the same provider.

func NewLeastActiveLoadBalance

func NewLeastActiveLoadBalance() cluster.LoadBalance

NewLeastActiveLoadBalance returns a least active load balance.

A random mechanism based on actives, actives means the number of a consumer's requests have been sent to provider but not yet got response.

func NewRandomLoadBalance

func NewRandomLoadBalance() cluster.LoadBalance

NewRandomLoadBalance returns a random load balance instance.

Set random probabilities by weight, and the request will be sent to provider randomly.

func NewRoundRobinLoadBalance

func NewRoundRobinLoadBalance() cluster.LoadBalance

NewRoundRobinLoadBalance returns a round robin load balance

Use the weight's common advisory to determine round robin ratio

Types

This section is empty.

Jump to

Keyboard shortcuts

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