Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for Envoy slow start mode. #4772

Merged
merged 6 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions apis/projectcontour/v1/httpproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,9 @@ type Service struct {
// The policies for rewriting Set-Cookie header attributes.
// +optional
CookieRewritePolicies []CookieRewritePolicy `json:"cookieRewritePolicies,omitempty"`
// Slow start will gradually increase amount of traffic to a newly added endpoint.
// +optional
SlowStart *SlowStart `json:"slowStart,omitempty"`
skriss marked this conversation as resolved.
Show resolved Hide resolved
}

// HTTPHealthCheckPolicy defines health checks on the upstream service.
Expand Down Expand Up @@ -1168,3 +1171,34 @@ type HTTPProxyList struct {
metav1.ListMeta `json:"metadata"`
Items []HTTPProxy `json:"items"`
}

// SlowStart will gradually increase amount of traffic to a newly added endpoint.
// It works only with RoundRobin and WeightedLeastRequest load balancing strategies.
skriss marked this conversation as resolved.
Show resolved Hide resolved
type SlowStart struct {
// The duration of slow start window.
// Duration is expressed in the Go [Duration format](https://godoc.org/time#ParseDuration).
// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
// +required
// +kubebuilder:validation:Pattern=`^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+)$`
Window string `json:"window"`

// The speed of traffic increase over the slow start window.
// Defaults to 1.0, so that endpoint would get linearly increasing amount of traffic.
// When increasing the value for this parameter, the speed of traffic ramp-up increases non-linearly.
// The value of aggression parameter should be greater than 0.0.
//
// More info: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/slow_start
//
// +optional
// +kubebuilder:default=`1.0`
// +kubebuilder:validation:Pattern=`^([0-9]+([.][0-9]+)?|[.][0-9]+)$`
Aggression string `json:"aggression"`

// The minimum percentage of origin weight that avoids too small new weight, which may cause endpoints in slow start mode receive no traffic in slow start window.
// If not specified, the default is 10%.
skriss marked this conversation as resolved.
Show resolved Hide resolved
skriss marked this conversation as resolved.
Show resolved Hide resolved
// +optional
// +kubebuilder:default=10
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=100
MinimumWeightPercent uint32 `json:"minWeightPercent"`
}
20 changes: 20 additions & 0 deletions apis/projectcontour/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions changelogs/unreleased/4772-tsaarni-major.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Slow start mode

Slow start mode is a configuration setting that is used to gradually increase the amount of traffic targeted to a newly added upstream endpoint.
This can be useful for example with JVM based applications, that might otherwise get overwhelmed during JIT warm-up period.
For more information [see here](https://projectcontour.io/docs/main/config/slow-start/).
72 changes: 72 additions & 0 deletions examples/contour/01-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3153,6 +3153,42 @@ spec:
type: object
type: array
type: object
slowStart:
description: Slow start will gradually increase amount
of traffic to a newly added endpoint.
properties:
aggression:
default: "1.0"
description: "The speed of traffic increase over the
slow start window. Defaults to 1.0, so that endpoint
would get linearly increasing amount of traffic.
When increasing the value for this parameter, the
speed of traffic ramp-up increases non-linearly.
The value of aggression parameter should be greater
than 0.0. \n More info: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/slow_start"
pattern: ^([0-9]+([.][0-9]+)?|[.][0-9]+)$
type: string
minWeightPercent:
default: 10
description: The minimum percentage of origin weight
that avoids too small new weight, which may cause
endpoints in slow start mode receive no traffic
in slow start window. If not specified, the default
is 10%.
format: int32
maximum: 100
minimum: 0
type: integer
window:
description: The duration of slow start window. Duration
is expressed in the Go [Duration format](https://godoc.org/time#ParseDuration).
Valid time units are "ns", "us" (or "µs"), "ms",
"s", "m", "h".
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+)$
type: string
required:
- window
type: object
validation:
description: UpstreamValidation defines how to verify
the backend service's certificate
Expand Down Expand Up @@ -3495,6 +3531,42 @@ spec:
type: object
type: array
type: object
slowStart:
description: Slow start will gradually increase amount of
traffic to a newly added endpoint.
properties:
aggression:
default: "1.0"
description: "The speed of traffic increase over the
slow start window. Defaults to 1.0, so that endpoint
would get linearly increasing amount of traffic. When
increasing the value for this parameter, the speed
of traffic ramp-up increases non-linearly. The value
of aggression parameter should be greater than 0.0.
\n More info: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/slow_start"
pattern: ^([0-9]+([.][0-9]+)?|[.][0-9]+)$
type: string
minWeightPercent:
default: 10
description: The minimum percentage of origin weight
that avoids too small new weight, which may cause
endpoints in slow start mode receive no traffic in
slow start window. If not specified, the default is
10%.
format: int32
maximum: 100
minimum: 0
type: integer
window:
description: The duration of slow start window. Duration
is expressed in the Go [Duration format](https://godoc.org/time#ParseDuration).
Valid time units are "ns", "us" (or "µs"), "ms", "s",
"m", "h".
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+)$
type: string
required:
- window
type: object
validation:
description: UpstreamValidation defines how to verify the
backend service's certificate
Expand Down
72 changes: 72 additions & 0 deletions examples/render/contour-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3362,6 +3362,42 @@ spec:
type: object
type: array
type: object
slowStart:
description: Slow start will gradually increase amount
of traffic to a newly added endpoint.
properties:
aggression:
default: "1.0"
description: "The speed of traffic increase over the
slow start window. Defaults to 1.0, so that endpoint
would get linearly increasing amount of traffic.
When increasing the value for this parameter, the
speed of traffic ramp-up increases non-linearly.
The value of aggression parameter should be greater
than 0.0. \n More info: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/slow_start"
pattern: ^([0-9]+([.][0-9]+)?|[.][0-9]+)$
type: string
minWeightPercent:
default: 10
description: The minimum percentage of origin weight
that avoids too small new weight, which may cause
endpoints in slow start mode receive no traffic
in slow start window. If not specified, the default
is 10%.
format: int32
maximum: 100
minimum: 0
type: integer
window:
description: The duration of slow start window. Duration
is expressed in the Go [Duration format](https://godoc.org/time#ParseDuration).
Valid time units are "ns", "us" (or "µs"), "ms",
"s", "m", "h".
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+)$
type: string
required:
- window
type: object
validation:
description: UpstreamValidation defines how to verify
the backend service's certificate
Expand Down Expand Up @@ -3704,6 +3740,42 @@ spec:
type: object
type: array
type: object
slowStart:
description: Slow start will gradually increase amount of
traffic to a newly added endpoint.
properties:
aggression:
default: "1.0"
description: "The speed of traffic increase over the
slow start window. Defaults to 1.0, so that endpoint
would get linearly increasing amount of traffic. When
increasing the value for this parameter, the speed
of traffic ramp-up increases non-linearly. The value
of aggression parameter should be greater than 0.0.
\n More info: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/slow_start"
pattern: ^([0-9]+([.][0-9]+)?|[.][0-9]+)$
type: string
minWeightPercent:
default: 10
description: The minimum percentage of origin weight
that avoids too small new weight, which may cause
endpoints in slow start mode receive no traffic in
slow start window. If not specified, the default is
10%.
format: int32
maximum: 100
minimum: 0
type: integer
window:
description: The duration of slow start window. Duration
is expressed in the Go [Duration format](https://godoc.org/time#ParseDuration).
Valid time units are "ns", "us" (or "µs"), "ms", "s",
"m", "h".
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+)$
type: string
required:
- window
type: object
validation:
description: UpstreamValidation defines how to verify the
backend service's certificate
Expand Down
72 changes: 72 additions & 0 deletions examples/render/contour-gateway-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3167,6 +3167,42 @@ spec:
type: object
type: array
type: object
slowStart:
description: Slow start will gradually increase amount
of traffic to a newly added endpoint.
properties:
aggression:
default: "1.0"
description: "The speed of traffic increase over the
slow start window. Defaults to 1.0, so that endpoint
would get linearly increasing amount of traffic.
When increasing the value for this parameter, the
speed of traffic ramp-up increases non-linearly.
The value of aggression parameter should be greater
than 0.0. \n More info: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/slow_start"
pattern: ^([0-9]+([.][0-9]+)?|[.][0-9]+)$
type: string
minWeightPercent:
default: 10
description: The minimum percentage of origin weight
that avoids too small new weight, which may cause
endpoints in slow start mode receive no traffic
in slow start window. If not specified, the default
is 10%.
format: int32
maximum: 100
minimum: 0
type: integer
window:
description: The duration of slow start window. Duration
is expressed in the Go [Duration format](https://godoc.org/time#ParseDuration).
Valid time units are "ns", "us" (or "µs"), "ms",
"s", "m", "h".
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+)$
type: string
required:
- window
type: object
validation:
description: UpstreamValidation defines how to verify
the backend service's certificate
Expand Down Expand Up @@ -3509,6 +3545,42 @@ spec:
type: object
type: array
type: object
slowStart:
description: Slow start will gradually increase amount of
traffic to a newly added endpoint.
properties:
aggression:
default: "1.0"
description: "The speed of traffic increase over the
slow start window. Defaults to 1.0, so that endpoint
would get linearly increasing amount of traffic. When
increasing the value for this parameter, the speed
of traffic ramp-up increases non-linearly. The value
of aggression parameter should be greater than 0.0.
\n More info: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/slow_start"
pattern: ^([0-9]+([.][0-9]+)?|[.][0-9]+)$
type: string
minWeightPercent:
default: 10
description: The minimum percentage of origin weight
that avoids too small new weight, which may cause
endpoints in slow start mode receive no traffic in
slow start window. If not specified, the default is
10%.
format: int32
maximum: 100
minimum: 0
type: integer
window:
description: The duration of slow start window. Duration
is expressed in the Go [Duration format](https://godoc.org/time#ParseDuration).
Valid time units are "ns", "us" (or "µs"), "ms", "s",
"m", "h".
pattern: ^(((\d*(\.\d*)?h)|(\d*(\.\d*)?m)|(\d*(\.\d*)?s)|(\d*(\.\d*)?ms)|(\d*(\.\d*)?us)|(\d*(\.\d*)?µs)|(\d*(\.\d*)?ns))+)$
type: string
required:
- window
type: object
validation:
description: UpstreamValidation defines how to verify the
backend service's certificate
Expand Down
Loading