• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2022 The gRPC Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Local copy of Envoy xDS proto file, used for testing only.
16
17syntax = "proto3";
18
19package envoy.extensions.load_balancing_policies.ring_hash.v3;
20
21import "google/protobuf/wrappers.proto";
22
23// [#protodoc-title: Ring Hash Load Balancing Policy]
24
25// This configuration allows the built-in RING_HASH LB policy to be configured via the LB policy
26// extension point. See the :ref:`load balancing architecture overview
27// <arch_overview_load_balancing_types>` for more information.
28// [#extension: envoy.clusters.lb_policy]
29// [#next-free-field: 6]
30message RingHash {
31  // The hash function used to hash hosts onto the ketama ring.
32  enum HashFunction {
33    // Currently defaults to XX_HASH.
34    DEFAULT_HASH = 0;
35
36    // Use `xxHash <https://github.com/Cyan4973/xxHash>`_.
37    XX_HASH = 1;
38
39    // Use `MurmurHash2 <https://sites.google.com/site/murmurhash/>`_, this is compatible with
40    // std:hash<string> in GNU libstdc++ 3.4.20 or above. This is typically the case when compiled
41    // on Linux and not macOS.
42    MURMUR_HASH_2 = 2;
43  }
44
45  // The hash function used to hash hosts onto the ketama ring. The value defaults to
46  // :ref:`XX_HASH<envoy_v3_api_enum_value_config.cluster.v3.Cluster.RingHashLbConfig.HashFunction.XX_HASH>`.
47  HashFunction hash_function = 1;
48
49  // Minimum hash ring size. The larger the ring is (that is, the more hashes there are for each
50  // provided host) the better the request distribution will reflect the desired weights. Defaults
51  // to 1024 entries, and limited to 8M entries. See also
52  // :ref:`maximum_ring_size<envoy_v3_api_field_config.cluster.v3.Cluster.RingHashLbConfig.maximum_ring_size>`.
53  google.protobuf.UInt64Value minimum_ring_size = 2;
54
55  // Maximum hash ring size. Defaults to 8M entries, and limited to 8M entries, but can be lowered
56  // to further constrain resource use. See also
57  // :ref:`minimum_ring_size<envoy_v3_api_field_config.cluster.v3.Cluster.RingHashLbConfig.minimum_ring_size>`.
58  google.protobuf.UInt64Value maximum_ring_size = 3;
59}
60