3 ms·
A simple round robin load balancer implemented in Go
- pageandrew 7y agonice. I have an architectural suggestion. You probably want to decouple the isAlive() check from the inbound request routing, as checking for upstream health on every single request is a little unnecessary and adds additional latency to each request. perhaps a separate goroutine to periodically check upstream health then flip a boolean if it goes unhealthy, which the request router could check on each request.
- eltonsv 7y agoThanks a lot for the suggestion! I will do that, and along the way add locks for all the alive variables for concurrency safety.