Skip to content

Commit

Permalink
load_balancing: support least_connections steering policy
Browse files Browse the repository at this point in the history
  • Loading branch information
tc80 committed Oct 5, 2023
1 parent 217beeb commit 2a42685
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/1414.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
load_balancing: extend documentation for least_connections steering policy
```
14 changes: 14 additions & 0 deletions load_balancing.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ type LoadBalancerOrigin struct {
//
// When LoadBalancerOriginSteering.Policy="least_outstanding_requests", this
// weight is used to scale the origin's outstanding requests.
// When LoadBalancerOriginSteering.Policy="least_connections", this
// weight is used to scale the origin's open connections.
Weight float64 `json:"weight"`
Header map[string][]string `json:"header"`
}
Expand All @@ -59,6 +61,10 @@ type LoadBalancerOriginSteering struct {
// "least_outstanding_requests": Select an origin by taking into consideration origin weights,
// as well as each origin's number of outstanding requests. Origins with more pending requests
// are weighted proportionately less relative to others.
//
// "least_connections": Select an origin by taking into consideration origin weights,
// as well as each origin's number of open connections. Origins with more open connections
// are weighted proportionately less relative to others. Supported for HTTP/1 and HTTP/2 connections.
Policy string `json:"policy,omitempty"`
}

Expand Down Expand Up @@ -127,6 +133,11 @@ type LoadBalancer struct {
// RandomSteering weights, as well as each pool's number of outstanding requests.
// Pools with more pending requests are weighted proportionately less relative to others.
//
// "least_connections": Select a pool by taking into consideration
// RandomSteering weights, as well as each pool's number of open connections.
// Pools with more open connections are weighted proportionately less relative to others.
// Supported for HTTP/1 and HTTP/2 connections.
//
// "": Maps to "geo" if RegionPools or PopPools or CountryPools have entries otherwise "off".
SteeringPolicy string `json:"steering_policy,omitempty"`
}
Expand Down Expand Up @@ -207,6 +218,9 @@ type LoadBalancerRuleOverrides struct {
//
// SteeringPolicy="least_outstanding_requests": Use pool weights to
// scale each pool's outstanding requests.
//
// SteeringPolicy="least_connections": Use pool weights to
// scale each pool's open connections.
type RandomSteering struct {
DefaultWeight float64 `json:"default_weight,omitempty"`
PoolWeights map[string]float64 `json:"pool_weights,omitempty"`
Expand Down

0 comments on commit 2a42685

Please sign in to comment.