Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 6 additions & 1 deletion api/envoy/config/cluster/v3/cluster.proto
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,17 @@ message Cluster {
// By tuning the parameter, is possible to achieve polynomial or exponential shape of ramp-up curve.
//
// During slow start window, effective weight of an endpoint would be scaled with time factor and aggression:
// `new_weight = weight * time_factor ^ (1 / aggression)`,
// `new_weight = weight * max(min_weight_percent, time_factor ^ (1 / aggression))`,
// where `time_factor=(time_since_start_seconds / slow_start_time_seconds)`.
//
// As time progresses, more and more traffic would be sent to endpoint, which is in slow start window.
// Once host exits slow start, time_factor and aggression no longer affect its weight.
core.v3.RuntimeDouble aggression = 2;

// Configures 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%.
type.v3.Percent min_weight_percent = 3;
}

// Specific configuration for the RoundRobin load balancing policy.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ During slow start window, load balancing weight of a particular endpoint will be

.. math::

NewWeight = {Weight*TimeFactor}^\frac{1}{Aggression}
NewWeight = {Weight}*{max(MinWeightPercent,{TimeFactor}^\frac{1}{Aggression})}

where,

Expand All @@ -25,6 +25,8 @@ where,

As time progresses, more and more traffic would be sent to endpoint within slow start window.

:ref:`MinWeightPercent parameter<envoy_v3_api_field_config.cluster.v3.Cluster.SlowStartConfig.min_weight_percent>` specifies the minimum percent of origin weight to make sure the EDF scheduler has a reasonable deadline, default is 10%.

:ref:`Aggression parameter<envoy_v3_api_field_config.cluster.v3.Cluster.SlowStartConfig.aggression>` non-linearly affects endpoint weight and represents the speed of ramp-up.
By tuning aggression parameter, one could achieve polynomial or exponential speed for traffic increase.
Below simulation demonstrates how various values for aggression affect traffic ramp-up:
Expand Down
1 change: 1 addition & 0 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Bug Fixes
* jwt_authn: fixed the crash when a CONNECT request is sent to JWT filter configured with regex match on the Host header.
* tcp_proxy: fix a crash that occurs when configured for :ref:`upstream tunneling <envoy_v3_api_field_extensions.filters.network.tcp_proxy.v3.TcpProxy.tunneling_config>` and the downstream connection disconnects while the the upstream connection or http/2 stream is still being established.
* tls: fix a bug while matching a certificate SAN with an exact value in ``match_typed_subject_alt_names`` of a listener where wildcard ``*`` character is not the only character of the dns label. Example, ``baz*.example.net`` and ``*baz.example.net`` and ``b*z.example.net`` will match ``baz1.example.net`` and ``foobaz.example.net`` and ``buzz.example.net``, respectively.
* upstream: cluster slow start config add ``min_weight_percent`` field to avoid too big EDF deadline which cause slow start endpoints receiving no traffic, default 10%. This fix is releted to `issue#19526 <https://github.com/envoyproxy/envoy/issues/19526>`_.
* upstream: fix stack overflow when a cluster with large number of idle connections is removed.
* xray: fix the AWS X-Ray tracer extension to not sample the trace if ``sampled=`` keyword is not present in the header ``x-amzn-trace-id``.

Expand Down
10 changes: 8 additions & 2 deletions source/common/upstream/load_balancer_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,12 @@ EdfLoadBalancerBase::EdfLoadBalancerBase(
slow_start_config.has_value() && slow_start_config.value().has_aggression()
? absl::optional<Runtime::Double>({slow_start_config.value().aggression(), runtime})
: absl::nullopt),
time_source_(time_source), latest_host_added_time_(time_source_.monotonicTime()) {
time_source_(time_source), latest_host_added_time_(time_source_.monotonicTime()),
slow_start_min_weight_percent_(slow_start_config.has_value()
? PROTOBUF_PERCENT_TO_DOUBLE_OR_DEFAULT(
slow_start_config.value(), min_weight_percent, 10) /
100.0
: 0.1) {
// We fully recompute the schedulers for a given host set here on membership change, which is
// consistent with what other LB implementations do (e.g. thread aware).
// The downside of a full recompute is that time complexity is O(n * log n),
Expand Down Expand Up @@ -987,7 +992,8 @@ double EdfLoadBalancerBase::applySlowStartFactor(double host_weight, const Host&
auto time_factor = static_cast<double>(std::max(std::chrono::milliseconds(1).count(),
host_create_duration.count())) /
slow_start_window_.count();
return host_weight * applyAggressionFactor(time_factor);
return host_weight *
std::max(applyAggressionFactor(time_factor), slow_start_min_weight_percent_);
} else {
return host_weight;
}
Expand Down
1 change: 1 addition & 0 deletions source/common/upstream/load_balancer_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ class EdfLoadBalancerBase : public ZoneAwareLoadBalancerBase,
const absl::optional<Runtime::Double> aggression_runtime_;
TimeSource& time_source_;
MonotonicTime latest_host_added_time_;
const double slow_start_min_weight_percent_;
};

/**
Expand Down
Loading