balance

package
v0.0.0-...-b6e34ba Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(sniConf *config.Sni, balance string) core.Balancer

*

  • Create new Balancer based on balancing strategy
  • Wrap it in middlewares if needed

Types

type IphashBalancer

type IphashBalancer struct{}

*

  • Iphash balancer

func (*IphashBalancer) Elect

func (b *IphashBalancer) Elect(context core.Context, backends []*core.Backend) (*core.Backend, error)

*

type LeastbandwidthBalancer

type LeastbandwidthBalancer struct{}

*

  • Leastbandwidth balancer

func (*LeastbandwidthBalancer) Elect

func (b *LeastbandwidthBalancer) Elect(context core.Context, backends []*core.Backend) (*core.Backend, error)

*

  • Elect backend using leastbandwidth strategy

type LeastconnBalancer

type LeastconnBalancer struct{}

*

  • Leastconn balancer

func (*LeastconnBalancer) Elect

func (b *LeastconnBalancer) Elect(context core.Context, backends []*core.Backend) (*core.Backend, error)

*

  • Elect backend using roundrobin strategy

type RoundrobinBalancer

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

*

  • Roundrobin balancer

func (*RoundrobinBalancer) Elect

func (b *RoundrobinBalancer) Elect(context core.Context, backends []*core.Backend) (*core.Backend, error)

*

  • Elect backend using roundrobin strategy

type WeightBalancer

type WeightBalancer struct{}

*

  • Weight balancer

func (*WeightBalancer) Elect

func (b *WeightBalancer) Elect(context core.Context, backends []*core.Backend) (*core.Backend, error)

*

  • Elect backend based on weight strategy
  • TODO: Ensure backends are sorted in the same way (not it's not bacause of map in scheduler)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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