temporalio / temporal

Temporal service
https://docs.temporal.io
MIT License
11.69k stars 827 forks source link

Use gRPC load balancer for frontend #62

Closed alexshtin closed 4 years ago

alexshtin commented 4 years ago

YARPC uses concept of dispatchers which are created with DispatcherProvider interface with one single implementation dnsDispatcherProvider. With migration to gRPC, call to DispatcherProvider was replaced with simple host:port. gRPC has support for round robin and custom load balancers as well as service configs. These approaches need to be investigated and Temporal should provide flexible plugable mechanism to support different load balancers for frontend.

https://medium.com/@ammar.daniel/grpc-client-side-load-balancing-in-go-cd2378b69242 https://itnext.io/on-grpc-load-balancing-683257c5b7b3

alexshtin commented 4 years ago

The right way to do this:

    conn, err := grpc.Dial(address,
        grpc.WithInsecure(),
        grpc.WithDisableServiceConfig(),
        grpc.WithDefaultServiceConfig(`{"loadBalancingConfig": [{"round_robin":{}}]}`),
    )

and address needs to be specified with dns:/// (yes 3! slashaes) prefix, like dns:///test.temporal.io:7233.