loadbalance

package
v1.5.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: Apache-2.0 Imports: 18 Imported by: 158

Documentation

Index

Constants

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

	// COMPLETE ...
	COMPLETE = 0
	// UPDATING ...
	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

type ConsistentHashSelector added in v1.3.0

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

ConsistentHashSelector implementation of Selector:get invoker based on load balancing strategy

func (*ConsistentHashSelector) Select added in v1.3.0

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