A simple HTTP load balancer and reverse proxy written in Go.
- Round Robin
- Least Connection
- Passive health check at configurable interval
- Request Id injection
- Config support using json
- Clone the repo using
git clone git@github.com:arbazsiddiqui/anabranch.git && cd anabranch
- Use the existing binary
anabranch
or build a new one usinggo build
- Change the existing config to your needs or create a new one.
- Run the load balancer using
./anabranch -config=./config.json
The port to the run the load balancer on.
A list of hosts we want to forward requests to.
Algorithm for load balancing. Can be roundRobin
or leastConnections
.
Defines the type of health check you want to perform on your host. Can be passive
or none
(for no health check). Active health check is WIP.
Time interval in seconds to perform health check on hosts.
Boolean to add a unique request id in header of every request to downstream hosts. Header name : Request-Id
{
"port": 9000,
"hosts": [
"http://localhost:8080",
"http://localhost:8081",
"http://localhost:8082"
],
"strategy" : "roundRobin",
"health_check_type" : "passive",
"health_check_interval" : 5,
"add_request_id" : true
}
- Add support for retires
- More test coverage
- Add support for active health check