https://github.com/esiqveland/balancer
Golang client side load balancer
https://github.com/esiqveland/balancer
dns go golang load-balancer loadbalancer
Last synced: 5 months ago
JSON representation
Golang client side load balancer
- Host: GitHub
- URL: https://github.com/esiqveland/balancer
- Owner: esiqveland
- Created: 2019-04-09T13:15:52.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-03T14:59:59.000Z (over 3 years ago)
- Last Synced: 2024-06-20T09:10:40.944Z (almost 2 years ago)
- Topics: dns, go, golang, load-balancer, loadbalancer
- Language: Go
- Homepage:
- Size: 23.4 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# balancer
A simple client side load balancer for go applications.
`balancer` was made to provide easier access to DNS-based load balancing for go services running in kubernetes and was mainly built for http.Client.
Grpc has its own DNS load balancer, use that one.
## Scope
This project does not do health checking and does not monitor status of any hosts.
This is left up to decide for a consul DNS or kubernetes DNS, and assumes hosts returned are deemed healthy.
This library does not retry or otherwise try to fix problems, leaving this up to the caller.
`balancer` currently assumes that a lookup will return a non-empty set of initial hosts on startup.
## TODO
- [X] Any logging?
- [X] Decide on a few error scenarios:
- [X] `netbalancer`: implement a timeout?
- [X] `netbalancer`: DNS lookup returned 0 hosts
- [X] `netbalancer`: DNS lookup returned error. We just log the error, effectively ignoring it
- [X] on error, return lookup error?
- [X] setting the hostlist to empty on error seems a bit drastic
- [X] on lookup error, we keep the old list and log error
- [ ] Tests
- [ ] Use option-func to configure debug mode (extra logging)
## Known limitations
- No health checking of hosts.
- `netbalancer` does not respect TTL of dns records as this is not exposed by the Go code.