MCPcopy Create free account
hub / github.com/zalando/skipper / newPowerOfRandomNChoices

Function newPowerOfRandomNChoices

loadbalancer/algorithm.go:235–240  ·  view source on GitHub ↗

newPowerOfRandomNChoices selects N random backends and picks the one with less outstanding requests.

([]string)

Source from the content-addressed store, hash-verified

233
234// newPowerOfRandomNChoices selects N random backends and picks the one with less outstanding requests.
235func newPowerOfRandomNChoices([]string) routing.LBAlgorithm {
236 return &powerOfRandomNChoices{
237 rnd: rand.New(rand.NewPCG(uint64(time.Now().UnixNano()), 0)), // #nosec
238 numberOfChoices: powerOfRandomNChoicesDefaultN,
239 }
240}
241
242// Apply implements routing.LBAlgorithm with power of random N choices algorithm.
243func (p *powerOfRandomNChoices) Apply(ctx *routing.LBContext) routing.LBEndpoint {

Callers 1

TestApplyFunction · 0.85

Calls 1

NewMethod · 0.80

Tested by 1

TestApplyFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…