gRPC Load Balancing with Nginx

Alex Tan
2 min readApr 11, 2018

--

Nginx recent release finally has native support for gRPC. It is a nice addition to existing tools such as Linkerd, Traefik, Envoy etc, but with much simpler configuration. 😄If you have tried Linkerd (which has an awesome dashboard!), you would definitely have agreed.

To test it out, we have a simple gRPC Echo service that will ingeniously return the text that is receives.

Our docker-compose.yml file would look like this:

docker-compose.yml

We have two gRPC servers running, a client and nginx.

The nginx.conf is rather simple:

nginx.conf

Running docker-compose up -d will give us the following output.

gRPC client logs

As you can see, the client manage to call the servers with different hostnames.

nginx logs

You can find the full repository here: https://github.com/alextanhongpin/grpc-nginx-docker

😄 Happy coding!

--

--