example/

directory
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2023 License: MIT

README

gRPC Load Balancing in 5 minutes

Prerequisites

Install Consul. You also need the Go toolchain installed, including gRPC bindings.

Install

Install and compile the examples:

$ go get github.com/olivere/grpc
$ cd $GOPATH/src/github.com/olivere/grpc/lb/consul/example
$ make

You should now have two files in the ./bin directory: server and client.

Try it

Run Consul. Something like this should do the job:

$ consul agent -dev -advertise=127.0.0.1

Start some servers (at least 2).

$ ./bin/server

Run the client, and execute e.g. 100 requests:

$ ./bin/client -n=100

Watch how the requests get load-balanced between the servers.

Directories

Path Synopsis
proto
echo
Package echo is a generated protocol buffer package.
Package echo is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL