The challenge was to use build your own Application Load Balancer. Supports -
- Distribute load to >= 2 servers
- Health checks the servers
- Handle server going offline
- Handle server coming back online
Steps to build the binary -
go build -o cc-load-balancer .
./cc-load-balancer -lb -lb-endpoints ":8080,:8081,:8082" -port 80
./cc-load-balancer -port 8080
Flag | Description | Default |
---|---|---|
-lb | Indicates a loadbalancer instance, if false indicates a backend server instance | false |
-lb-endpoints | Comma separated list of endpoints to load balance | "" |
-port | Port to run the server on (this can be load balancer or backend server) | 80 |