This is a gRPC load balancer for go, supports Random, RoundRobin and smooth weigthed balance algo.
grpclb-schduler's some code refer to github.com/liyue201/grpc-lb
- format code
- custom logger
- timeout control
- add nginx's smooth weighted round-robin balancing
- add active grpc health check
- fix consul serverEntry interface conv bug
- deincr health interval
- more ...
consul agent -dev
cd examples/consul/server
go run main_server.go -node node1 -port 11111
go run main_server.go -node node2 -port 22222
go run main_server.go -node node3 -port 33333
show on consul dashboard
or
show on consul http api
curl -s "http://127.0.0.1:8500/v1/health/service/test?passing=true"
cd examples/consul/client
go run main_client.go
stdout:
Hello consul, I am node1
active sleep 2s, u can stop a node
Hello consul, I am node2
active sleep 2s, u can stop a node
Hello consul, I am node3
active sleep 2s, u can stop a node
Hello consul, I am node1
active sleep 2s, u can stop a node
Hello consul, I am node2
active sleep 2s, u can stop a node
Hello consul, I am node3
active sleep 2s, u can stop a node
Hello consul, I am node1
active sleep 2s, u can stop a node
Hello consul, I am node2
active sleep 2s, u can stop a node
Hello consul, I am node3
active sleep 2s, u can stop a node
Hello consul, I am node1
active sleep 2s, u can stop a node