mirror of https://github.com/grpc/grpc-java.git
doc: add document on WRR configure examples from service config and xds (#11344)
This commit is contained in:
parent
7a53fa8bc1
commit
9e2145970a
|
|
@ -64,6 +64,30 @@ import java.util.logging.Logger;
|
|||
* A {@link LoadBalancer} that provides weighted-round-robin load-balancing over the
|
||||
* {@link EquivalentAddressGroup}s from the {@link NameResolver}. The subchannel weights are
|
||||
* determined by backend metrics using ORCA.
|
||||
* To use WRR, users may configure through channel serviceConfig. Example config:
|
||||
* <pre> {@code
|
||||
* String wrrConfig = "{\"loadBalancingConfig\":" +
|
||||
* "[{\"weighted_round_robin\":{\"enableOobLoadReport\":true, " +
|
||||
* "\"blackoutPeriod\":\"10s\"," +
|
||||
* "\"oobReportingPeriod\":\"10s\"," +
|
||||
* "\"weightExpirationPeriod\":\"180s\"," +
|
||||
* "\"errorUtilizationPenalty\":\"1.0\"," +
|
||||
* "\"weightUpdatePeriod\":\"1s\"}}]}";
|
||||
* serviceConfig = (Map<String, ?>) JsonParser.parse(wrrConfig);
|
||||
* channel = ManagedChannelBuilder.forTarget("test:///lb.test.grpc.io")
|
||||
* .defaultServiceConfig(serviceConfig)
|
||||
* .build();
|
||||
* }
|
||||
* </pre>
|
||||
* Users may also configure through xDS control plane via custom lb policy. But that is much more
|
||||
* complex to set up. Example config:
|
||||
* <pre>
|
||||
* localityLbPolicies:
|
||||
* - customPolicy:
|
||||
* name: weighted_round_robin
|
||||
* data: '{ "enableOobLoadReport": true }'
|
||||
* </pre>
|
||||
* See related documentation: https://cloud.google.com/service-mesh/legacy/load-balancing-apis/proxyless-configure-advanced-traffic-management#custom-lb-config
|
||||
*/
|
||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/9885")
|
||||
final class WeightedRoundRobinLoadBalancer extends RoundRobinLoadBalancer {
|
||||
|
|
|
|||
Loading…
Reference in New Issue