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

Function computeLoadAverage

loadbalancer/algorithm.go:166–173  ·  view source on GitHub ↗
(ctx *routing.LBContext)

Source from the content-addressed store, hash-verified

164}
165
166func computeLoadAverage(ctx *routing.LBContext) float64 {
167 sum := 1.0 // add 1 to include the request that just arrived
168 endpoints := ctx.LBEndpoints
169 for _, v := range endpoints {
170 sum += float64(v.Metrics.InflightRequests())
171 }
172 return sum / float64(len(endpoints))
173}
174
175// Returns index of endpoint with closest hash to key's hash, which is also below the target load
176// skipEndpoint function is used to skip endpoints we don't want, for example, fading endpoints

Callers 1

boundedLoadSearchMethod · 0.85

Calls 1

InflightRequestsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…