What is Load Balancer?
Definition: Load Balancer is the mechanism that takes the incoming traffic (load) and evenly distributes it to the group of backend resources or servers.
Why do we need a Load Balancer?
- Scenario: You are running an online store and there are 1000 daily online visitors/customers.
- In the backend, there is one Virtual Machine (VM), to process all the requests.
- Time passes, you are popular, and the traffic started increasing and your single VM is not able to handle the traffic, so you add another VM to process the additional traffic/load.
- Now you have 2 VMs to process the incoming requests.
- But how to decide on which VM to transfer the incoming traffic?
- Here comes the use of Load Balancer. You put a load balancer in front of two VMs.
- Now the load balancer will decide where the traffic goes.
Notes:
- Load Balancer distributes new requests that come to load balancer’s front end to the backend server, according to Rules and Health Probes.
- Health Probe is a service that makes sure that VM/server is ready to receive the traffic before the load balancer sends any traffic. This will ensure the traffic is going to the healthy server.
- Load balancer balances incoming as well as outgoing load.
- Port Forwarding is also supported in Load Balancer to forward the traffic to a specific machine in the backend pool using IP adder and Port.