Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/improbable-eng/go-srvlb
DNS SRV Load Balancer for gRPC
https://github.com/improbable-eng/go-srvlb
dns golang grpc grpc-gateway lb load-balancer srv
Last synced: 2 months ago
JSON representation
DNS SRV Load Balancer for gRPC
- Host: GitHub
- URL: https://github.com/improbable-eng/go-srvlb
- Owner: improbable-eng
- License: apache-2.0
- Created: 2016-11-29T09:48:28.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-10T17:35:45.000Z (about 7 years ago)
- Last Synced: 2024-06-18T21:44:35.094Z (7 months ago)
- Topics: dns, golang, grpc, grpc-gateway, lb, load-balancer, srv
- Language: Go
- Size: 23.4 KB
- Stars: 42
- Watchers: 6
- Forks: 11
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go gRPC DNS SRV Load Balancer
[![Go Report Card](https://goreportcard.com/badge/github.com/improbable-eng/go-srvlb)](http://goreportcard.com/report/improbable-eng/go-srvlb)
[![GoDoc](http://img.shields.io/badge/GoDoc-Reference-blue.svg)](https://godoc.org/github.com/improbable-eng/go-srvlb)
[![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
[![Build Status](https://travis-ci.org/improbable-eng/go-srvlb.svg?branch=master)](https://travis-ci.org/improbable-eng/go-srvlb)A gRPC [`naming.Resolver`](https://godoc.org/google.golang.org/grpc/naming) that uses [DNS SRV](https://en.wikipedia.org/wiki/SRV_record).
This allows you to do simple client-side Round Robin load balancing of gRPC requests.# Usage
```go
rr := grpc.RoundRobin(grpcsrvlb.New(srv.NewGoResolver(2 * time.Second)))
conn, err := grpc.Dial("grpc.my_service.my_cluster.internal.example.com", grpc.WithBalancer(rr))
```This will resolve the DNS SRV address `grpc.my_service.my_cluster.internal.example.com` using the Golang DNS resolver
with an assumed TTL of 2 seconds and use that as a set of backends for the gRPC `RoundRobin` policy. From this point on
all requests on the `conn` (reusable across gRPC clients) will be load balanced to a set of these backends.# Status
This is *alpha* software. It should work, but key components are missing:
* [ ] unit tests
* [ ] integration tests with gRPC
* [ ] `srv.Resolver` implementation that respects `TTL`, see [miekg/dns](https://github.com/miekg/dns)# License
`go-srvlb` is released under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details.