You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constgrpc=require("@grpc/grpc-js");const{ GrpcTransport }=require("@protobuf-ts/grpc-transport");tc=require("./proto-gen/demo/demoapp/v1/demoapp.client")// Define a function to create a gRPC client with round_robin load balancingfunctioncreateGrpcClient(url){constrpcTransport=newGrpcTransport({host: url,channelCredentials: grpc.credentials.createInsecure(),clientOptions: {'grpc.lb_policy_name': 'round_robin','grpc.service_config': JSON.stringify({loadBalancingConfig: [{round_robin: {}}]})}});returnnewtc.TaxpnlgraphServiceClient(rpcTransport)}
For the server-side backends, it is DNS-based load balancing.
In our case, this is golang gRPC server. 5 instances, different IP and multivalve DNS.
Locally, we could use docker-compose aliases
Our general recommendation is that servers should drop connections periodically to signal to clients that they should update name resolution information. In grpc-js, you can do this by using the grpc.max_connection_age_ms and grpc.max_connection_age_grace_ms options on the server. The grpc.max_connection_age_ms should be tuned based on how frequently you expect clients to need to get new DNS resolution information. The grpc.max_connection_age_grace_ms controls how long a server will spend processing requests on a connection after telling the client to stop using that connection, so you should set that based on the longest it generally takes the server to process a request.
As a side note, the grpc.lb_policy_name is obsolete, and the grpc.service_config option is its replacement. There is no reason to specify both.
Problem description
dns_resolver
doesn't refresh the DNS over time, or we don't know how to make this configuration.round_robin
lb_policy_name. In the case ofTRANSIENT_FAILURE
DNS, get refreshed after1.11.3
bug fix.dns_resolver
will not refresh the DNSReproduction steps
For the server-side backends, it is DNS-based load balancing.
In our case, this is golang gRPC server. 5 instances, different IP and multivalve DNS.
Locally, we could use docker-compose aliases
Environment
public.ecr.aws/docker/library/node:v16-alpine3.17
Apline x64
^16
npm ci
"@grpc/grpc-js": "1.11.3"
,"@protobuf-ts/grpc-transport": "2.9.4"
Additional context
What we did:
log.txt
The text was updated successfully, but these errors were encountered: