loadbalance

package
Version: v1.5.7 Latest Latest
Warning

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

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

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 added in v1.3.0

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

type ConsistentHashLoadBalance added in v1.3.0

type ConsistentHashLoadBalance struct {
}

ConsistentHashLoadBalance implementation of load balancing: using consistent hashing

func (*ConsistentHashLoadBalance) Select added in v1.3.0

func (lb *ConsistentHashLoadBalance) Select(invokers []protocol.Invoker, invocation protocol.Invocation) protocol.Invoker

Select gets invoker based on load balancing strategy

Jump to

Keyboard shortcuts

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