From 04935da9c881862fc548ec6e4ce2acbc8ea3b65a Mon Sep 17 00:00:00 2001 From: "data-plane-api(CircleCI)" Date: Thu, 3 Sep 2020 20:11:40 +0000 Subject: [PATCH] load balancer: Add a option to configure the table size of maglev (#12870) Currently, the maglev hash algorithm default to table size to 65537. It is the recommended size by a paper but it is better if the user can set this value. This patch introduces a new MaglevLbConfig that contains table size of maglev. So, now, the user can set the table size of maglev by their situation. Signed-off-by: DongRyeol Cha Mirrored from https://github.com/envoyproxy/envoy @ 5fd73ca889aa12618c626c96bb33fde4707f8bf0 --- envoy/config/cluster/v3/cluster.proto | 20 ++++++++++++++++--- envoy/config/cluster/v4alpha/cluster.proto | 23 +++++++++++++++++++--- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/envoy/config/cluster/v3/cluster.proto b/envoy/config/cluster/v3/cluster.proto index 64c68c6b..3571ccf9 100644 --- a/envoy/config/cluster/v3/cluster.proto +++ b/envoy/config/cluster/v3/cluster.proto @@ -43,7 +43,7 @@ message ClusterCollection { } // Configuration for a single upstream cluster. -// [#next-free-field: 52] +// [#next-free-field: 53] message Cluster { option (udpa.annotations.versioning).previous_message_type = "envoy.api.v2.Cluster"; @@ -410,6 +410,16 @@ message Cluster { google.protobuf.UInt64Value maximum_ring_size = 4 [(validate.rules).uint64 = {lte: 8388608}]; } + // Specific configuration for the :ref:`Maglev` + // load balancing policy. + message MaglevLbConfig { + // The table size for Maglev hashing. The Maglev aims for ‘minimal disruption’ rather than an absolute guarantee. + // Minimal disruption means that when the set of upstreams changes, a connection will likely be sent to the same + // upstream as it was before. Increasing the table size reduces the amount of disruption. + // The table size must be prime number. If it is not specified, the default is 65537. + google.protobuf.UInt64Value table_size = 1; + } + // Specific configuration for the // :ref:`Original Destination ` // load balancing policy. @@ -830,15 +840,19 @@ message Cluster { // Optional configuration for the load balancing algorithm selected by // LbPolicy. Currently only - // :ref:`RING_HASH` and + // :ref:`RING_HASH`, + // :ref:`MAGLEV` and // :ref:`LEAST_REQUEST` // has additional configuration options. - // Specifying ring_hash_lb_config or least_request_lb_config without setting the corresponding + // Specifying ring_hash_lb_config or maglev_lb_config or least_request_lb_config without setting the corresponding // LbPolicy will generate an error at runtime. oneof lb_config { // Optional configuration for the Ring Hash load balancing policy. RingHashLbConfig ring_hash_lb_config = 23; + // Optional configuration for the Maglev load balancing policy. + MaglevLbConfig maglev_lb_config = 52; + // Optional configuration for the Original Destination load balancing policy. OriginalDstLbConfig original_dst_lb_config = 34; diff --git a/envoy/config/cluster/v4alpha/cluster.proto b/envoy/config/cluster/v4alpha/cluster.proto index 5a98b784..9b753683 100644 --- a/envoy/config/cluster/v4alpha/cluster.proto +++ b/envoy/config/cluster/v4alpha/cluster.proto @@ -45,7 +45,7 @@ message ClusterCollection { } // Configuration for a single upstream cluster. -// [#next-free-field: 52] +// [#next-free-field: 53] message Cluster { option (udpa.annotations.versioning).previous_message_type = "envoy.config.cluster.v3.Cluster"; @@ -413,6 +413,19 @@ message Cluster { google.protobuf.UInt64Value maximum_ring_size = 4 [(validate.rules).uint64 = {lte: 8388608}]; } + // Specific configuration for the :ref:`Maglev` + // load balancing policy. + message MaglevLbConfig { + option (udpa.annotations.versioning).previous_message_type = + "envoy.config.cluster.v3.Cluster.MaglevLbConfig"; + + // The table size for Maglev hashing. The Maglev aims for ‘minimal disruption’ rather than an absolute guarantee. + // Minimal disruption means that when the set of upstreams changes, a connection will likely be sent to the same + // upstream as it was before. Increasing the table size reduces the amount of disruption. + // The table size must be prime number. If it is not specified, the default is 65537. + google.protobuf.UInt64Value table_size = 1; + } + // Specific configuration for the // :ref:`Original Destination ` // load balancing policy. @@ -837,15 +850,19 @@ message Cluster { // Optional configuration for the load balancing algorithm selected by // LbPolicy. Currently only - // :ref:`RING_HASH` and + // :ref:`RING_HASH`, + // :ref:`MAGLEV` and // :ref:`LEAST_REQUEST` // has additional configuration options. - // Specifying ring_hash_lb_config or least_request_lb_config without setting the corresponding + // Specifying ring_hash_lb_config or maglev_lb_config or least_request_lb_config without setting the corresponding // LbPolicy will generate an error at runtime. oneof lb_config { // Optional configuration for the Ring Hash load balancing policy. RingHashLbConfig ring_hash_lb_config = 23; + // Optional configuration for the Maglev load balancing policy. + MaglevLbConfig maglev_lb_config = 52; + // Optional configuration for the Original Destination load balancing policy. OriginalDstLbConfig original_dst_lb_config = 34;