service_config.proto 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789
  1. // Copyright 2016 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. // A ServiceConfig is supplied when a service is deployed. It mostly contains
  15. // parameters for how clients that connect to the service should behave (for
  16. // example, the load balancing policy to use to pick between service replicas).
  17. //
  18. // The configuration options provided here act as overrides to automatically
  19. // chosen option values. Service owners should be conservative in specifying
  20. // options as the system is likely to choose better values for these options in
  21. // the vast majority of cases. In other words, please specify a configuration
  22. // option only if you really have to, and avoid copy-paste inclusion of configs.
  23. //
  24. // Note that gRPC uses the service config in JSON form, not in protobuf
  25. // form. This proto definition is intended to help document the schema but
  26. // will not actually be used directly by gRPC.
  27. syntax = "proto3";
  28. package grpc.service_config;
  29. import "google/protobuf/duration.proto";
  30. import "google/protobuf/struct.proto";
  31. import "google/protobuf/wrappers.proto";
  32. import "google/rpc/code.proto";
  33. import "grpc/lookup/v1/rls_config.proto";
  34. option java_package = "io.grpc.serviceconfig";
  35. option java_multiple_files = true;
  36. option java_outer_classname = "ServiceConfigProto";
  37. // Configuration for a method.
  38. message MethodConfig {
  39. // The names of the methods to which this configuration applies.
  40. // - MethodConfig without names (empty list) will be skipped.
  41. // - Each name entry must be unique across the entire ServiceConfig.
  42. // - If the 'method' field is empty, this MethodConfig specifies the defaults
  43. // for all methods for the specified service.
  44. // - If the 'service' field is empty, the 'method' field must be empty, and
  45. // this MethodConfig specifies the default for all methods (it's the default
  46. // config).
  47. //
  48. // When determining which MethodConfig to use for a given RPC, the most
  49. // specific match wins. For example, let's say that the service config
  50. // contains the following MethodConfig entries:
  51. //
  52. // method_config { name { } ... }
  53. // method_config { name { service: "MyService" } ... }
  54. // method_config { name { service: "MyService" method: "Foo" } ... }
  55. //
  56. // MyService/Foo will use the third entry, because it exactly matches the
  57. // service and method name. MyService/Bar will use the second entry, because
  58. // it provides the default for all methods of MyService. AnotherService/Baz
  59. // will use the first entry, because it doesn't match the other two.
  60. //
  61. // In JSON representation, value "", value `null`, and not present are the
  62. // same. The following are the same Name:
  63. // - { "service": "s" }
  64. // - { "service": "s", "method": null }
  65. // - { "service": "s", "method": "" }
  66. message Name {
  67. string service = 1; // Required. Includes proto package name.
  68. string method = 2;
  69. }
  70. repeated Name name = 1;
  71. // Whether RPCs sent to this method should wait until the connection is
  72. // ready by default. If false, the RPC will abort immediately if there is
  73. // a transient failure connecting to the server. Otherwise, gRPC will
  74. // attempt to connect until the deadline is exceeded.
  75. //
  76. // The value specified via the gRPC client API will override the value
  77. // set here. However, note that setting the value in the client API will
  78. // also affect transient errors encountered during name resolution, which
  79. // cannot be caught by the value here, since the service config is
  80. // obtained by the gRPC client via name resolution.
  81. google.protobuf.BoolValue wait_for_ready = 2;
  82. // The default timeout in seconds for RPCs sent to this method. This can be
  83. // overridden in code. If no reply is received in the specified amount of
  84. // time, the request is aborted and a DEADLINE_EXCEEDED error status
  85. // is returned to the caller.
  86. //
  87. // The actual deadline used will be the minimum of the value specified here
  88. // and the value set by the application via the gRPC client API. If either
  89. // one is not set, then the other will be used. If neither is set, then the
  90. // request has no deadline.
  91. google.protobuf.Duration timeout = 3;
  92. // The maximum allowed payload size for an individual request or object in a
  93. // stream (client->server) in bytes. The size which is measured is the
  94. // serialized payload after per-message compression (but before stream
  95. // compression) in bytes. This applies both to streaming and non-streaming
  96. // requests.
  97. //
  98. // The actual value used is the minimum of the value specified here and the
  99. // value set by the application via the gRPC client API. If either one is
  100. // not set, then the other will be used. If neither is set, then the
  101. // built-in default is used.
  102. //
  103. // If a client attempts to send an object larger than this value, it will not
  104. // be sent and the client will see a ClientError.
  105. // Note that 0 is a valid value, meaning that the request message
  106. // must be empty.
  107. google.protobuf.UInt32Value max_request_message_bytes = 4;
  108. // The maximum allowed payload size for an individual response or object in a
  109. // stream (server->client) in bytes. The size which is measured is the
  110. // serialized payload after per-message compression (but before stream
  111. // compression) in bytes. This applies both to streaming and non-streaming
  112. // requests.
  113. //
  114. // The actual value used is the minimum of the value specified here and the
  115. // value set by the application via the gRPC client API. If either one is
  116. // not set, then the other will be used. If neither is set, then the
  117. // built-in default is used.
  118. //
  119. // If a server attempts to send an object larger than this value, it will not
  120. // be sent, and a ServerError will be sent to the client instead.
  121. // Note that 0 is a valid value, meaning that the response message
  122. // must be empty.
  123. google.protobuf.UInt32Value max_response_message_bytes = 5;
  124. // The retry policy for outgoing RPCs.
  125. message RetryPolicy {
  126. // The maximum number of RPC attempts, including the original attempt.
  127. //
  128. // This field is required and must be greater than 1.
  129. // Any value greater than 5 will be treated as if it were 5.
  130. uint32 max_attempts = 1;
  131. // Exponential backoff parameters. The initial retry attempt will occur at
  132. // random(0, initial_backoff). In general, the nth attempt will occur at
  133. // random(0,
  134. // min(initial_backoff*backoff_multiplier**(n-1), max_backoff)).
  135. // Required. Must be greater than zero.
  136. google.protobuf.Duration initial_backoff = 2;
  137. // Required. Must be greater than zero.
  138. google.protobuf.Duration max_backoff = 3;
  139. float backoff_multiplier = 4; // Required. Must be greater than zero.
  140. // The set of status codes which may be retried.
  141. //
  142. // This field is required and must be non-empty.
  143. repeated google.rpc.Code retryable_status_codes = 5;
  144. }
  145. // The hedging policy for outgoing RPCs. Hedged RPCs may execute more than
  146. // once on the server, so only idempotent methods should specify a hedging
  147. // policy.
  148. message HedgingPolicy {
  149. // The hedging policy will send up to max_requests RPCs.
  150. // This number represents the total number of all attempts, including
  151. // the original attempt.
  152. //
  153. // This field is required and must be greater than 1.
  154. // Any value greater than 5 will be treated as if it were 5.
  155. uint32 max_attempts = 1;
  156. // The first RPC will be sent immediately, but the max_requests-1 subsequent
  157. // hedged RPCs will be sent at intervals of every hedging_delay. Set this
  158. // to 0 to immediately send all max_requests RPCs.
  159. google.protobuf.Duration hedging_delay = 2;
  160. // The set of status codes which indicate other hedged RPCs may still
  161. // succeed. If a non-fatal status code is returned by the server, hedged
  162. // RPCs will continue. Otherwise, outstanding requests will be canceled and
  163. // the error returned to the client application layer.
  164. //
  165. // This field is optional.
  166. repeated google.rpc.Code non_fatal_status_codes = 3;
  167. }
  168. // Only one of retry_policy or hedging_policy may be set. If neither is set,
  169. // RPCs will not be retried or hedged.
  170. oneof retry_or_hedging_policy {
  171. RetryPolicy retry_policy = 6;
  172. HedgingPolicy hedging_policy = 7;
  173. }
  174. }
  175. // Configuration for pick_first LB policy.
  176. message PickFirstConfig {
  177. // If set to true, instructs the LB policy to randomly shuffle the list of
  178. // addresses received from the name resolver before attempting to connect to
  179. // them.
  180. bool shuffle_address_list = 1;
  181. }
  182. // Configuration for round_robin LB policy.
  183. message RoundRobinConfig {}
  184. // Configuration for weighted_round_robin LB policy.
  185. message WeightedRoundRobinLbConfig {
  186. // Whether to enable out-of-band utilization reporting collection from
  187. // the endpoints. By default, per-request utilization reporting is used.
  188. google.protobuf.BoolValue enable_oob_load_report = 1;
  189. // Load reporting interval to request from the server. Note that the
  190. // server may not provide reports as frequently as the client requests.
  191. // Used only when enable_oob_load_report is true. Default is 10 seconds.
  192. google.protobuf.Duration oob_reporting_period = 2;
  193. // A given endpoint must report load metrics continuously for at least
  194. // this long before the endpoint weight will be used. This avoids
  195. // churn when the set of endpoint addresses changes. Takes effect
  196. // both immediately after we establish a connection to an endpoint and
  197. // after weight_expiration_period has caused us to stop using the most
  198. // recent load metrics. Default is 10 seconds.
  199. google.protobuf.Duration blackout_period = 3;
  200. // If a given endpoint has not reported load metrics in this long,
  201. // then we stop using the reported weight. This ensures that we do
  202. // not continue to use very stale weights. Once we stop using a stale
  203. // value, if we later start seeing fresh reports again, the
  204. // blackout_period applies. Defaults to 3 minutes.
  205. google.protobuf.Duration weight_expiration_period = 4;
  206. // How often endpoint weights are recalculated. Values less than 100ms are
  207. // capped at 100ms. Default is 1 second.
  208. google.protobuf.Duration weight_update_period = 5;
  209. // The multiplier used to adjust endpoint weights with the error rate
  210. // calculated as eps/qps. Configuration is rejected if this value is negative.
  211. // Default is 1.0.
  212. google.protobuf.FloatValue error_utilization_penalty = 6;
  213. }
  214. // Configuration for outlier_detection LB policy
  215. message OutlierDetectionLoadBalancingConfig {
  216. // The time interval between ejection analysis sweeps. This can result in
  217. // both new ejections as well as addresses being returned to service. Defaults
  218. // to 10000ms or 10s.
  219. google.protobuf.Duration interval = 1;
  220. // The base time that as address is ejected for. The real time is equal to the
  221. // base time multiplied by the number of times the address has been ejected.
  222. // Defaults to 30000ms or 30s.
  223. google.protobuf.Duration base_ejection_time = 2;
  224. // The maximum time that an address is ejected for. If not specified, the default value (300000ms or 300s) or
  225. // the base_ejection_time value is applied, whatever is larger.
  226. google.protobuf.Duration max_ejection_time = 3;
  227. // The maximum % of an address list that can be ejected due to outlier
  228. // detection. Defaults to 10% but will eject at least one address regardless of the value.
  229. google.protobuf.UInt32Value max_ejection_percent = 4;
  230. // Parameters for the success rate ejection algorithm.
  231. // This algorithm monitors the request success rate for all endpoints and
  232. // ejects individual endpoints whose success rates are statistical outliers.
  233. message SuccessRateEjection {
  234. // This factor is used to determine the ejection threshold for success rate
  235. // outlier ejection. The ejection threshold is the difference between the
  236. // mean success rate, and the product of this factor and the standard
  237. // deviation of the mean success rate: mean - (stdev *
  238. // success_rate_stdev_factor). This factor is divided by a thousand to get a
  239. // double. That is, if the desired factor is 1.9, the runtime value should
  240. // be 1900. Defaults to 1900.
  241. google.protobuf.UInt32Value stdev_factor = 1;
  242. // The % chance that an address will be actually ejected when an outlier status
  243. // is detected through success rate statistics. This setting can be used to
  244. // disable ejection or to ramp it up slowly. Defaults to 100.
  245. google.protobuf.UInt32Value enforcement_percentage = 2;
  246. // The number of addresses that must have enough request volume to
  247. // detect success rate outliers. If the number of addresses is less than this
  248. // setting, outlier detection via success rate statistics is not performed
  249. // for any addresses. Defaults to 5.
  250. google.protobuf.UInt32Value minimum_hosts = 3;
  251. // The minimum number of total requests that must be collected in one
  252. // interval (as defined by the interval duration above) to include this address
  253. // in success rate based outlier detection. If the volume is lower than this
  254. // setting, outlier detection via success rate statistics is not performed
  255. // for that address. Defaults to 100.
  256. google.protobuf.UInt32Value request_volume = 4;
  257. }
  258. // Parameters for the failure percentage algorithm.
  259. // This algorithm ejects individual endpoints whose failure rate is greater than
  260. // some threshold, independently of any other endpoint.
  261. message FailurePercentageEjection {
  262. // The failure percentage to use when determining failure percentage-based outlier detection. If
  263. // the failure percentage of a given address is greater than or equal to this value, it will be
  264. // ejected. Defaults to 85.
  265. google.protobuf.UInt32Value threshold = 1;
  266. // The % chance that an address will be actually ejected when an outlier status is detected through
  267. // failure percentage statistics. This setting can be used to disable ejection or to ramp it up
  268. // slowly. Defaults to 100.
  269. google.protobuf.UInt32Value enforcement_percentage = 2;
  270. // The minimum number of addresses in order to perform failure percentage-based ejection.
  271. // If the total number of addresses is less than this value, failure percentage-based
  272. // ejection will not be performed. Defaults to 5.
  273. google.protobuf.UInt32Value minimum_hosts = 3;
  274. // The minimum number of total requests that must be collected in one interval (as defined by the
  275. // interval duration above) to perform failure percentage-based ejection for this address. If the
  276. // volume is lower than this setting, failure percentage-based ejection will not be performed for
  277. // this host. Defaults to 50.
  278. google.protobuf.UInt32Value request_volume = 4;
  279. }
  280. // If set, success rate ejections will be performed
  281. SuccessRateEjection success_rate_ejection = 5;
  282. // If set, failure rate ejections will be performed
  283. FailurePercentageEjection failure_percentage_ejection = 6;
  284. // The config for the child policy
  285. repeated LoadBalancingConfig child_policy = 13;
  286. }
  287. // Configuration for grpclb LB policy.
  288. message GrpcLbConfig {
  289. // Optional. What LB policy to use for routing between the backend
  290. // addresses. If unset, defaults to round_robin.
  291. // Currently, the only supported values are round_robin and pick_first.
  292. // Note that this will be used both in balancer mode and in fallback mode.
  293. // Multiple LB policies can be specified; clients will iterate through
  294. // the list in order and stop at the first policy that they support.
  295. repeated LoadBalancingConfig child_policy = 1;
  296. // Optional. If specified, overrides the name of the service to be sent to
  297. // the balancer.
  298. string service_name = 2;
  299. // Optional. The timeout in seconds for receiving the server list from the LB
  300. // server. Defaults to 10s.
  301. google.protobuf.Duration initial_fallback_timeout = 3;
  302. }
  303. // Configuration for priority LB policy.
  304. message PriorityLoadBalancingPolicyConfig {
  305. // A map of name to child policy configuration.
  306. // The names are used to allow the priority policy to update
  307. // existing child policies instead of creating new ones every
  308. // time it receives a config update.
  309. message Child {
  310. repeated LoadBalancingConfig config = 1;
  311. // If true, will ignore reresolution requests from this child.
  312. bool ignore_reresolution_requests = 2;
  313. }
  314. map<string, Child> children = 1;
  315. // A list of child names in decreasing priority order
  316. // (i.e., first element is the highest priority).
  317. repeated string priorities = 2;
  318. }
  319. // Configuration for weighted_target LB policy.
  320. message WeightedTargetLoadBalancingPolicyConfig {
  321. message Target {
  322. uint32 weight = 1;
  323. repeated LoadBalancingConfig child_policy = 2;
  324. }
  325. map<string, Target> targets = 1;
  326. }
  327. // Config for RLS LB policy.
  328. message RlsLoadBalancingPolicyConfig {
  329. grpc.lookup.v1.RouteLookupConfig route_lookup_config = 1;
  330. // Service config to use for the RLS channel.
  331. ServiceConfig route_lookup_channel_service_config = 2;
  332. repeated LoadBalancingConfig child_policy = 3;
  333. // Field name to add to child policy config to contain the target name.
  334. string child_policy_config_target_field_name = 4;
  335. }
  336. // Configuration for xds_cluster_manager_experimental LB policy.
  337. message XdsClusterManagerLoadBalancingPolicyConfig {
  338. message Child {
  339. repeated LoadBalancingConfig child_policy = 1;
  340. }
  341. map<string, Child> children = 1;
  342. }
  343. // Configuration for the cds LB policy.
  344. message CdsConfig {
  345. string cluster = 1; // Required.
  346. }
  347. // Represents an xDS server.
  348. message XdsServer {
  349. string server_uri = 1 [json_name = "server_uri"]; // Required.
  350. message ChannelCredentials {
  351. string type = 1; // Required.
  352. google.protobuf.Struct config = 2; // Optional JSON config.
  353. }
  354. // A list of channel creds to use. The first supported type will be used.
  355. repeated ChannelCredentials channel_creds = 2 [json_name = "channel_creds"];
  356. // A repeated list of server features.
  357. repeated google.protobuf.Value server_features = 3
  358. [json_name = "server_features"];
  359. }
  360. // Configuration for xds_cluster_resolver LB policy.
  361. message XdsClusterResolverLoadBalancingPolicyConfig {
  362. // Describes a discovery mechanism instance.
  363. // For EDS or LOGICAL_DNS clusters, there will be exactly one
  364. // DiscoveryMechanism, which will describe the cluster of the parent
  365. // CDS policy.
  366. // For aggregate clusters, there will be one DiscoveryMechanism for each
  367. // underlying cluster.
  368. message DiscoveryMechanism {
  369. // Cluster name.
  370. string cluster = 1;
  371. // LRS server to send load reports to.
  372. // If not present, load reporting will be disabled.
  373. // If set to the empty string, load reporting will be sent to the same
  374. // server that we obtained CDS data from.
  375. // DEPRECATED: Use new lrs_load_reporting_server field instead.
  376. google.protobuf.StringValue lrs_load_reporting_server_name = 2
  377. [deprecated=true];
  378. // LRS server to send load reports to.
  379. // If not present, load reporting will be disabled.
  380. // Supercedes lrs_load_reporting_server_name field.
  381. XdsServer lrs_load_reporting_server = 7;
  382. // Maximum number of outstanding requests can be made to the upstream
  383. // cluster. Default is 1024.
  384. google.protobuf.UInt32Value max_concurrent_requests = 3;
  385. enum Type {
  386. UNKNOWN = 0;
  387. EDS = 1;
  388. LOGICAL_DNS = 2;
  389. };
  390. Type type = 4;
  391. // For type EDS only.
  392. // EDS service name, as returned in CDS.
  393. // May be unset if not specified in CDS.
  394. string eds_service_name = 5;
  395. // For type LOGICAL_DNS only.
  396. // DNS name to resolve in "host:port" form.
  397. string dns_hostname = 6;
  398. // The configuration for outlier_detection child policies
  399. // Within this message, the child_policy field will be ignored
  400. OutlierDetectionLoadBalancingConfig outlier_detection = 8;
  401. // The configuration for xds_override_host child policy
  402. repeated OverrideHostLoadBalancingPolicyConfig.HealthStatus override_host_status = 9;
  403. // Telemetry labels associated with this cluster
  404. map<string, string> telemetry_labels = 10;
  405. }
  406. // Ordered list of discovery mechanisms.
  407. // Must have at least one element.
  408. // Results from each discovery mechanism are concatenated together in
  409. // successive priorities.
  410. repeated DiscoveryMechanism discovery_mechanisms = 1;
  411. // xDS LB policy. Will be used as the child config of the xds_cluster_impl LB policy.
  412. repeated LoadBalancingConfig xds_lb_policy = 2;
  413. }
  414. // Configuration for xds_cluster_impl LB policy.
  415. message XdsClusterImplLoadBalancingPolicyConfig {
  416. // Cluster name. Required.
  417. string cluster = 1;
  418. // EDS service name.
  419. // Not set if cluster is not an EDS cluster or if it does not
  420. // specify an EDS service name.
  421. string eds_service_name = 2;
  422. // Server to send load reports to.
  423. // If unset, no load reporting is done.
  424. // If set to empty string, load reporting will be sent to the same
  425. // server as we are getting xds data from.
  426. // DEPRECATED: Use new lrs_load_reporting_server field instead.
  427. google.protobuf.StringValue lrs_load_reporting_server_name = 3
  428. [deprecated=true];
  429. // LRS server to send load reports to.
  430. // If not present, load reporting will be disabled.
  431. // Supercedes lrs_load_reporting_server_name field.
  432. XdsServer lrs_load_reporting_server = 7;
  433. // Maximum number of outstanding requests can be made to the upstream cluster.
  434. // Default is 1024.
  435. google.protobuf.UInt32Value max_concurrent_requests = 4;
  436. // Drop configuration.
  437. message DropCategory {
  438. string category = 1;
  439. uint32 requests_per_million = 2;
  440. }
  441. repeated DropCategory drop_categories = 5;
  442. // Child policy.
  443. repeated LoadBalancingConfig child_policy = 6;
  444. // Telemetry labels associated with this cluster
  445. map<string, string> telemetry_labels = 8;
  446. }
  447. // Configuration for eds LB policy.
  448. message EdsLoadBalancingPolicyConfig {
  449. // Cluster name. Required.
  450. string cluster = 1;
  451. // EDS service name, as returned in CDS.
  452. // May be unset if not specified in CDS.
  453. string eds_service_name = 2;
  454. // Server to send load reports to.
  455. // If unset, no load reporting is done.
  456. // If set to empty string, load reporting will be sent to the same
  457. // server as we are getting xds data from.
  458. google.protobuf.StringValue lrs_load_reporting_server_name = 3;
  459. // Locality-picking policy.
  460. // This policy's config is expected to be in the format used
  461. // by the weighted_target policy. Note that the config should include
  462. // an empty value for the "targets" field; that empty value will be
  463. // replaced by one that is dynamically generated based on the EDS data.
  464. // Optional; defaults to "weighted_target".
  465. repeated LoadBalancingConfig locality_picking_policy = 4;
  466. // Endpoint-picking policy.
  467. // This will be configured as the policy for each child in the
  468. // locality-policy's config.
  469. // Optional; defaults to "round_robin".
  470. repeated LoadBalancingConfig endpoint_picking_policy = 5;
  471. }
  472. // Configuration for ring_hash LB policy.
  473. message RingHashLoadBalancingConfig {
  474. // A client-side option will cap these values to 4096. If either of these
  475. // values are greater than the client-side cap, they will be treated
  476. // as the client-side cap value.
  477. uint64 min_ring_size = 1; // Optional, defaults to 1024, max 8M.
  478. uint64 max_ring_size = 2; // Optional, defaults to 4096, max 8M.
  479. }
  480. // Configuration for lrs LB policy.
  481. message LrsLoadBalancingPolicyConfig {
  482. // Cluster name. Required.
  483. string cluster_name = 1;
  484. // EDS service name, as returned in CDS.
  485. // May be unset if not specified in CDS.
  486. string eds_service_name = 2;
  487. // Server to send load reports to. Required.
  488. // If set to empty string, load reporting will be sent to the same
  489. // server as we are getting xds data from.
  490. string lrs_load_reporting_server_name = 3;
  491. // The locality for which this policy will report load. Required.
  492. message Locality {
  493. string region = 1;
  494. string zone = 2;
  495. string subzone = 3;
  496. }
  497. Locality locality = 4;
  498. // Endpoint-picking policy.
  499. repeated LoadBalancingConfig child_policy = 5;
  500. }
  501. // Configuration for the xds_wrr_locality load balancing policy.
  502. message XdsWrrLocalityLoadBalancingPolicyConfig {
  503. repeated LoadBalancingConfig child_policy = 1;
  504. }
  505. // Configuration for the least_request LB policy.
  506. message LeastRequestLocalityLoadBalancingPolicyConfig {
  507. uint64 choice_count = 1;
  508. }
  509. // Configuration for the override_host LB policy.
  510. message OverrideHostLoadBalancingPolicyConfig {
  511. enum HealthStatus {
  512. UNKNOWN = 0;
  513. HEALTHY = 1;
  514. DRAINING = 3;
  515. }
  516. // valid health status for hosts that are considered when using
  517. // xds_override_host_experimental policy.
  518. // Default is [UNKNOWN, HEALTHY]
  519. repeated HealthStatus override_host_status = 1;
  520. repeated LoadBalancingConfig child_policy = 2;
  521. }
  522. // Configuration for xds LB policy.
  523. message XdsConfig {
  524. // Name of balancer to connect to.
  525. string balancer_name = 1 [deprecated = true];
  526. // Optional. What LB policy to use for intra-locality routing.
  527. // If unset, will use whatever algorithm is specified by the balancer.
  528. // Multiple LB policies can be specified; clients will iterate through
  529. // the list in order and stop at the first policy that they support.
  530. repeated LoadBalancingConfig child_policy = 2;
  531. // Optional. What LB policy to use in fallback mode. If not
  532. // specified, defaults to round_robin.
  533. // Multiple LB policies can be specified; clients will iterate through
  534. // the list in order and stop at the first policy that they support.
  535. repeated LoadBalancingConfig fallback_policy = 3;
  536. // Optional. Name to use in EDS query. If not present, defaults to
  537. // the server name from the target URI.
  538. string eds_service_name = 4;
  539. // LRS server to send load reports to.
  540. // If not present, load reporting will be disabled.
  541. // If set to the empty string, load reporting will be sent to the same
  542. // server that we obtained CDS data from.
  543. google.protobuf.StringValue lrs_load_reporting_server_name = 5;
  544. }
  545. // Selects LB policy and provides corresponding configuration.
  546. //
  547. // In general, all instances of this field should be repeated. Clients will
  548. // iterate through the list in order and stop at the first policy that they
  549. // support. This allows the service config to specify custom policies that may
  550. // not be known to all clients.
  551. //
  552. // - If the config for the first supported policy is invalid, the whole service
  553. // config is invalid.
  554. // - If the list doesn't contain any supported policy, the whole service config
  555. // is invalid.
  556. message LoadBalancingConfig {
  557. // Exactly one LB policy may be configured.
  558. oneof policy {
  559. // For each new LB policy supported by gRPC, a new field must be added
  560. // here. The field's name must be the LB policy name and its type is a
  561. // message that provides whatever configuration parameters are needed
  562. // by the LB policy. The configuration message will be passed to the
  563. // LB policy when it is instantiated on the client.
  564. //
  565. // If the LB policy does not require any configuration parameters, the
  566. // message for that LB policy may be empty.
  567. //
  568. // Note that if an LB policy contains another nested LB policy
  569. // (e.g., a gslb policy picks the cluster and then delegates to
  570. // a round_robin policy to pick the backend within that cluster), its
  571. // configuration message may include a nested instance of the
  572. // LoadBalancingConfig message to configure the nested LB policy.
  573. PickFirstConfig pick_first = 4 [json_name = "pick_first"];
  574. RoundRobinConfig round_robin = 1 [json_name = "round_robin"];
  575. WeightedRoundRobinLbConfig weighted_round_robin = 20
  576. [json_name = "weighted_round_robin"];
  577. // gRPC lookaside load balancing.
  578. // This will eventually be deprecated by the new xDS-based local
  579. // balancing policy.
  580. GrpcLbConfig grpclb = 3;
  581. // REMAINING POLICIES ARE EXPERIMENTAL -- DO NOT USE
  582. PriorityLoadBalancingPolicyConfig priority_experimental = 9
  583. [json_name = "priority_experimental"];
  584. WeightedTargetLoadBalancingPolicyConfig weighted_target_experimental = 10
  585. [json_name = "weighted_target_experimental"];
  586. OutlierDetectionLoadBalancingConfig outlier_detection = 15
  587. [json_name = "outlier_detection_experimental"];
  588. RlsLoadBalancingPolicyConfig rls = 19 [json_name = "rls_experimental"];
  589. // xDS-based load balancing.
  590. XdsClusterManagerLoadBalancingPolicyConfig xds_cluster_manager_experimental
  591. = 14 [json_name = "xds_cluster_manager_experimental"];
  592. CdsConfig cds_experimental = 6 [json_name = "cds_experimental"];
  593. XdsClusterResolverLoadBalancingPolicyConfig
  594. xds_cluster_resolver_experimental = 11
  595. [json_name = "xds_cluster_resolver_experimental"];
  596. XdsClusterImplLoadBalancingPolicyConfig xds_cluster_impl_experimental = 12
  597. [json_name = "xds_cluster_impl_experimental"];
  598. OverrideHostLoadBalancingPolicyConfig override_host_experimental = 18
  599. [json_name = "override_host_experimental"];
  600. XdsWrrLocalityLoadBalancingPolicyConfig xds_wrr_locality_experimental = 16
  601. [json_name = "xds_wrr_locality_experimental"];
  602. RingHashLoadBalancingConfig ring_hash_experimental = 13
  603. [json_name = "ring_hash_experimental"];
  604. LeastRequestLocalityLoadBalancingPolicyConfig least_request_experimental =
  605. 17 [json_name = "least_request_experimental"];
  606. // Deprecated xDS-related policies.
  607. LrsLoadBalancingPolicyConfig lrs_experimental = 8
  608. [json_name = "lrs_experimental", deprecated = true];
  609. EdsLoadBalancingPolicyConfig eds_experimental = 7
  610. [json_name = "eds_experimental", deprecated = true];
  611. XdsConfig xds = 2 [deprecated = true];
  612. XdsConfig xds_experimental = 5 [json_name = "xds_experimental",
  613. deprecated = true];
  614. // Next available ID: 21
  615. }
  616. }
  617. // A ServiceConfig represents information about a service but is not specific to
  618. // any name resolver.
  619. message ServiceConfig {
  620. // Load balancing policy.
  621. //
  622. // Note that load_balancing_policy is deprecated in favor of
  623. // load_balancing_config; the former will be used only if the latter
  624. // is unset.
  625. //
  626. // If no LB policy is configured here, then the default is pick_first.
  627. // If the policy name is set via the client API, that value overrides
  628. // the value specified here.
  629. //
  630. // If the deprecated load_balancing_policy field is used, note that if the
  631. // resolver returns at least one balancer address (as opposed to backend
  632. // addresses), gRPC will use grpclb (see
  633. // https://github.com/grpc/grpc/blob/master/doc/load-balancing.md),
  634. // regardless of what policy is configured here. However, if the resolver
  635. // returns at least one backend address in addition to the balancer
  636. // address(es), the client may fall back to the requested policy if it
  637. // is unable to reach any of the grpclb load balancers.
  638. enum LoadBalancingPolicy {
  639. UNSPECIFIED = 0;
  640. ROUND_ROBIN = 1;
  641. }
  642. LoadBalancingPolicy load_balancing_policy = 1 [deprecated = true];
  643. // Multiple LB policies can be specified; clients will iterate through
  644. // the list in order and stop at the first policy that they support. If none
  645. // are supported, the service config is considered invalid.
  646. repeated LoadBalancingConfig load_balancing_config = 4;
  647. // Per-method configuration.
  648. repeated MethodConfig method_config = 2;
  649. // If a RetryThrottlingPolicy is provided, gRPC will automatically throttle
  650. // retry attempts and hedged RPCs when the client's ratio of failures to
  651. // successes exceeds a threshold.
  652. //
  653. // For each server name, the gRPC client will maintain a token_count which is
  654. // initially set to max_tokens. Every outgoing RPC (regardless of service or
  655. // method invoked) will change token_count as follows:
  656. //
  657. // - Every failed RPC will decrement the token_count by 1.
  658. // - Every successful RPC will increment the token_count by token_ratio.
  659. //
  660. // If token_count is less than or equal to max_tokens / 2, then RPCs will not
  661. // be retried and hedged RPCs will not be sent.
  662. message RetryThrottlingPolicy {
  663. // The number of tokens starts at max_tokens. The token_count will always be
  664. // between 0 and max_tokens.
  665. //
  666. // This field is required and must be greater than zero.
  667. uint32 max_tokens = 1;
  668. // The amount of tokens to add on each successful RPC. Typically this will
  669. // be some number between 0 and 1, e.g., 0.1.
  670. //
  671. // This field is required and must be greater than zero. Up to 3 decimal
  672. // places are supported.
  673. float token_ratio = 2;
  674. }
  675. RetryThrottlingPolicy retry_throttling = 3;
  676. message HealthCheckConfig {
  677. // Service name to use in the health-checking request.
  678. google.protobuf.StringValue service_name = 1;
  679. }
  680. HealthCheckConfig health_check_config = 5;
  681. // next available tag: 6
  682. }