I am trying to understand out how client side load balancing works. So far I have been able to understand following.
- There is no centralized load balancer.
- Load balancer now resides with the service itself.
- These load balancers know about all of the service instances (their ip port etc.) through service discovery.
- Depending upon load balancing algorithm they can forward the requests to these instances.
What I don't understand : How would client make a request, In traditional load balancer, user can make a request using dns name for the load balancer, but how would that go in client side load balancing especially in cloud environment where instances will come and go.
The keyword here is Service Discovery.
You will need to have a central register where all instances of your services are listed (and unlisted if they go down for some reason). Your client-side load balancer can then ask the register for the URLs of the service instances and select one of them.
A tool that does this is Eureka, for example.