From be4bdbaa7b1130c86f068efcebbee9017e0fef14 Mon Sep 17 00:00:00 2001 From: Terry Wilson Date: Sun, 15 May 2022 12:37:37 -0700 Subject: [PATCH] xds: add config for least_request LB policy extension (#21210) Signed-off-by: Terry Wilson --- .../least_request/v3/BUILD | 13 +++++ .../least_request/v3/least_request.proto | 58 +++++++++++++++++++ api/versioning/BUILD | 1 + 3 files changed, 72 insertions(+) create mode 100644 api/envoy/extensions/load_balancing_policies/least_request/v3/BUILD create mode 100644 api/envoy/extensions/load_balancing_policies/least_request/v3/least_request.proto diff --git a/api/envoy/extensions/load_balancing_policies/least_request/v3/BUILD b/api/envoy/extensions/load_balancing_policies/least_request/v3/BUILD new file mode 100644 index 000000000000..2a87d27d297b --- /dev/null +++ b/api/envoy/extensions/load_balancing_policies/least_request/v3/BUILD @@ -0,0 +1,13 @@ +# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. + +load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") + +licenses(["notice"]) # Apache 2 + +api_proto_package( + deps = [ + "//envoy/config/cluster/v3:pkg", + "//envoy/config/core/v3:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], +) diff --git a/api/envoy/extensions/load_balancing_policies/least_request/v3/least_request.proto b/api/envoy/extensions/load_balancing_policies/least_request/v3/least_request.proto new file mode 100644 index 000000000000..97efd9183250 --- /dev/null +++ b/api/envoy/extensions/load_balancing_policies/least_request/v3/least_request.proto @@ -0,0 +1,58 @@ +syntax = "proto3"; + +package envoy.extensions.load_balancing_policies.least_request.v3; + +import "envoy/config/cluster/v3/cluster.proto"; +import "envoy/config/core/v3/base.proto"; + +import "google/protobuf/wrappers.proto"; + +import "udpa/annotations/status.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.load_balancing_policies.least_request.v3"; +option java_outer_classname = "LeastRequestProto"; +option java_multiple_files = true; +option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/least_request/v3;least_requestv3"; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Least Request Load Balancing Policy] + +// This configuration allows the built-in LEAST_REQUEST LB policy to be configured via the LB policy +// extension point. See the :ref:`load balancing architecture overview +// ` for more information. +// [#extension: envoy.clusters.lb_policy] +message LeastRequest { + // The number of random healthy hosts from which the host with the fewest active requests will + // be chosen. Defaults to 2 so that we perform two-choice selection if the field is not set. + google.protobuf.UInt32Value choice_count = 1 [(validate.rules).uint32 = {gte: 2}]; + + // The following formula is used to calculate the dynamic weights when hosts have different load + // balancing weights: + // + // `weight = load_balancing_weight / (active_requests + 1)^active_request_bias` + // + // The larger the active request bias is, the more aggressively active requests will lower the + // effective weight when all host weights are not equal. + // + // `active_request_bias` must be greater than or equal to 0.0. + // + // When `active_request_bias == 0.0` the Least Request Load Balancer doesn't consider the number + // of active requests at the time it picks a host and behaves like the Round Robin Load + // Balancer. + // + // When `active_request_bias > 0.0` the Least Request Load Balancer scales the load balancing + // weight by the number of active requests at the time it does a pick. + // + // The value is cached for performance reasons and refreshed whenever one of the Load Balancer's + // host sets changes, e.g., whenever there is a host membership update or a host load balancing + // weight change. + // + // .. note:: + // This setting only takes effect if all host weights are not equal. + config.core.v3.RuntimeDouble active_request_bias = 2; + + // Configuration for slow start mode. + // If this configuration is not set, slow start will not be not enabled. + config.cluster.v3.Cluster.SlowStartConfig slow_start_config = 3; +} diff --git a/api/versioning/BUILD b/api/versioning/BUILD index 6c6b513116e1..ea4f915244dd 100644 --- a/api/versioning/BUILD +++ b/api/versioning/BUILD @@ -165,6 +165,7 @@ proto_library( "//envoy/extensions/internal_redirect/previous_routes/v3:pkg", "//envoy/extensions/internal_redirect/safe_cross_scheme/v3:pkg", "//envoy/extensions/key_value/file_based/v3:pkg", + "//envoy/extensions/load_balancing_policies/least_request/v3:pkg", "//envoy/extensions/load_balancing_policies/ring_hash/v3:pkg", "//envoy/extensions/load_balancing_policies/round_robin/v3:pkg", "//envoy/extensions/load_balancing_policies/wrr_locality/v3:pkg",