Demo video tutorial for testing: https://www.youtube.com/watch?v=SkQ6s_nwCgY
Current implementation uses round robin algorithm for distributing requests.
Also, it periodically checks the availabilty of backends and stops forwarding requests to the unavailable servers.
As soon as dead server is back and up & running it starts forwarding requests to it.
Comprehensive testing instructions:
Configure load balancer in src/main/resources/application.conf
:
Run a few backends on different ports:
Run the load balancer and observe health check logs:
Ping the load balancer and observe responses from different servers:
Stop one of the backends (8081):
Observe the load balancer adjust distributing requests to only two servers:
Run the server with port 8081 again:
Observe the load balancer adjust distributing requests to all three servers again: