Skip to content

Commit 3144c52

Browse files
committed
feat(loadbalancer): support slow start aggression and minWeightPercent
Expose the `aggression` and `minWeightPercent` parameters of Envoy's SlowStartConfig via BackendTrafficPolicy. Previously only the slow start `window` was configurable, which limited users to a linear ramp-up. `aggression` enables polynomial/exponential ramp-up curves, and `minWeightPercent` guards against starvation when the scaled weight would otherwise approach zero. Addresses the existing TODO in the SlowStart API type. Signed-off-by: Adam Buran <aburan28@gmail.com>
1 parent f404a9c commit 3144c52

24 files changed

Lines changed: 1611 additions & 87 deletions

api/v1alpha1/loadbalancer_types.go

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,35 @@ const (
287287
type SlowStart struct {
288288
// Window defines the duration of the warm up period for newly added host.
289289
// During slow start window, traffic sent to the newly added hosts will gradually increase.
290-
// Currently only supports linear growth of traffic. For additional details,
290+
// For additional details,
291291
// see https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/cluster/v3/cluster.proto#config-cluster-v3-cluster-slowstartconfig
292292
// +kubebuilder:validation:Required
293293
Window *gwapiv1.Duration `json:"window"`
294-
// TODO: Add support for non-linear traffic increases based on user usage.
294+
295+
// Aggression controls the speed at which the endpoint weight ramps up during the
296+
// slow start window. The endpoint weight is scaled by the time factor raised to
297+
// the power of (1 / aggression). Values greater than 1.0 result in a faster
298+
// initial ramp-up followed by a slower approach to the full weight (exponential),
299+
// while values less than 1.0 result in a slower initial ramp-up followed by a
300+
// faster approach to the full weight (logarithmic).
301+
//
302+
// Must be a positive decimal number (e.g. "1.0", "1.5", "2.0"). If unset,
303+
// Envoy uses its default of 1.0, which produces a linear ramp-up.
304+
//
305+
// +optional
306+
// +kubebuilder:validation:Pattern=`^([0-9]+(\.[0-9]+)?|\.[0-9]+)$`
307+
// +kubebuilder:validation:XValidation:rule="self != '0' && self != '0.0' && self != '.0'",message="aggression must be greater than 0"
308+
Aggression *string `json:"aggression,omitempty"`
309+
310+
// MinWeightPercent specifies the minimum percent of origin weight that avoids
311+
// too small new weight when an endpoint is in slow start window. This ensures
312+
// that the EDF scheduler has a reasonable deadline. If unset, Envoy uses its
313+
// default of 10%.
314+
//
315+
// +optional
316+
// +kubebuilder:validation:Minimum=0
317+
// +kubebuilder:validation:Maximum=100
318+
MinWeightPercent *uint32 `json:"minWeightPercent,omitempty"`
295319
}
296320

297321
// ZoneAware defines the configuration related to the distribution of requests between locality zones.

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_backendtrafficpolicies.yaml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,11 +1048,37 @@ spec:
10481048
If set, during slow start window, traffic sent to the newly added hosts will gradually increase.
10491049
Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers.
10501050
properties:
1051+
aggression:
1052+
description: |-
1053+
Aggression controls the speed at which the endpoint weight ramps up during the
1054+
slow start window. The endpoint weight is scaled by the time factor raised to
1055+
the power of (1 / aggression). Values greater than 1.0 result in a faster
1056+
initial ramp-up followed by a slower approach to the full weight (exponential),
1057+
while values less than 1.0 result in a slower initial ramp-up followed by a
1058+
faster approach to the full weight (logarithmic).
1059+
1060+
Must be a positive decimal number (e.g. "1.0", "1.5", "2.0"). If unset,
1061+
Envoy uses its default of 1.0, which produces a linear ramp-up.
1062+
pattern: ^([0-9]+(\.[0-9]+)?|\.[0-9]+)$
1063+
type: string
1064+
x-kubernetes-validations:
1065+
- message: aggression must be greater than 0
1066+
rule: self != '0' && self != '0.0' && self != '.0'
1067+
minWeightPercent:
1068+
description: |-
1069+
MinWeightPercent specifies the minimum percent of origin weight that avoids
1070+
too small new weight when an endpoint is in slow start window. This ensures
1071+
that the EDF scheduler has a reasonable deadline. If unset, Envoy uses its
1072+
default of 10%.
1073+
format: int32
1074+
maximum: 100
1075+
minimum: 0
1076+
type: integer
10511077
window:
10521078
description: |-
10531079
Window defines the duration of the warm up period for newly added host.
10541080
During slow start window, traffic sent to the newly added hosts will gradually increase.
1055-
Currently only supports linear growth of traffic. For additional details,
1081+
For additional details,
10561082
see https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/cluster/v3/cluster.proto#config-cluster-v3-cluster-slowstartconfig
10571083
pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$
10581084
type: string

charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_envoyextensionpolicies.yaml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,11 +1135,38 @@ spec:
11351135
If set, during slow start window, traffic sent to the newly added hosts will gradually increase.
11361136
Supported for RoundRobin, LeastRequest, and BackendUtilization load balancers.
11371137
properties:
1138+
aggression:
1139+
description: |-
1140+
Aggression controls the speed at which the endpoint weight ramps up during the
1141+
slow start window. The endpoint weight is scaled by the time factor raised to
1142+
the power of (1 / aggression). Values greater than 1.0 result in a faster
1143+
initial ramp-up followed by a slower approach to the full weight (exponential),
1144+
while values less than 1.0 result in a slower initial ramp-up followed by a
1145+
faster approach to the full weight (logarithmic).
1146+
1147+
Must be a positive decimal number (e.g. "1.0", "1.5", "2.0"). If unset,
1148+
Envoy uses its default of 1.0, which produces a linear ramp-up.
1149+
pattern: ^([0-9]+(\.[0-9]+)?|\.[0-9]+)$
1150+
type: string
1151+
x-kubernetes-validations:
1152+
- message: aggression must be greater than 0
1153+
rule: self != '0' && self != '0.0' && self !=
1154+
'.0'
1155+
minWeightPercent:
1156+
description: |-
1157+
MinWeightPercent specifies the minimum percent of origin weight that avoids
1158+
too small new weight when an endpoint is in slow start window. This ensures
1159+
that the EDF scheduler has a reasonable deadline. If unset, Envoy uses its
1160+
default of 10%.
1161+
format: int32
1162+
maximum: 100
1163+
minimum: 0
1164+
type: integer
11381165
window:
11391166
description: |-
11401167
Window defines the duration of the warm up period for newly added host.
11411168
During slow start window, traffic sent to the newly added hosts will gradually increase.
1142-
Currently only supports linear growth of traffic. For additional details,
1169+
For additional details,
11431170
see https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/cluster/v3/cluster.proto#config-cluster-v3-cluster-slowstartconfig
11441171
pattern: ^([0-9]{1,5}(h|m|s|ms)){1,4}$
11451172
type: string

0 commit comments

Comments
 (0)