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 <dr83.cha@samsung.com>

Mirrored from https://github.com/envoyproxy/envoy @ 5fd73ca889aa12618c626c96bb33fde4707f8bf0
master-ci-test
data-plane-api(CircleCI) 4 years ago
parent 7b75d57760
commit 04935da9c8
  1. 20
      envoy/config/cluster/v3/cluster.proto
  2. 23
      envoy/config/cluster/v4alpha/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<arch_overview_load_balancing_types_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 <arch_overview_load_balancing_types_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<envoy_api_enum_value_config.cluster.v3.Cluster.LbPolicy.RING_HASH>` and
// :ref:`RING_HASH<envoy_api_enum_value_config.cluster.v3.Cluster.LbPolicy.RING_HASH>`,
// :ref:`MAGLEV<envoy_api_enum_value_config.cluster.v3.Cluster.LbPolicy.MAGLEV>` and
// :ref:`LEAST_REQUEST<envoy_api_enum_value_config.cluster.v3.Cluster.LbPolicy.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;

@ -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<arch_overview_load_balancing_types_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 <arch_overview_load_balancing_types_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<envoy_api_enum_value_config.cluster.v4alpha.Cluster.LbPolicy.RING_HASH>` and
// :ref:`RING_HASH<envoy_api_enum_value_config.cluster.v4alpha.Cluster.LbPolicy.RING_HASH>`,
// :ref:`MAGLEV<envoy_api_enum_value_config.cluster.v4alpha.Cluster.LbPolicy.MAGLEV>` and
// :ref:`LEAST_REQUEST<envoy_api_enum_value_config.cluster.v4alpha.Cluster.LbPolicy.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;

Loading…
Cancel
Save