Networking - Load Balancing
Load Balancing is a technique used in networking and computing to distribute incoming traffic or workload across multiple servers or resources so that no single server becomes overloaded.
What Load Balancing Means
Imagine a restaurant with only one counter. If many people come at once, the counter gets crowded and slow. But if the restaurant opens multiple counters and distributes customers evenly, everyone gets faster service.
Similarly, in a network, load balancing spreads traffic across several servers so that:
-
performance stays fast
-
no server crashes due to overload
-
users get reliable, smooth access
Why Load Balancing Is Important
-
Prevents Server Overload
Ensures no single server gets too much traffic. -
Improves Performance
Users experience faster response times. -
Ensures High Availability
If one server fails, traffic is automatically shifted to other working servers. -
Scales Easily
You can add more servers as your traffic grows.
How Load Balancing Works
A Load Balancer sits in front of multiple servers. When a request comes in (like opening a website), the load balancer decides which server should handle it.
Common Methods the Load Balancer Uses:
-
Round Robin → Sends each request to the next server in a cycle.
-
Least Connections → Sends traffic to the server with the fewest current users.
-
IP Hash → Directs users based on their IP address.
-
Weighted Distribution → Servers with more capacity get more traffic.
Types of Load Balancers
-
Hardware Load Balancers – Physical devices used in big companies.
-
Software Load Balancers – Programs like Nginx, HAProxy, AWS ELB.
-
DNS Load Balancing – Distributes traffic using domain name records.
Real-Life Example
If a website gets millions of visitors (like Amazon or Netflix), one server cannot handle all those requests. Load balancing splits the traffic across many servers, ensuring the site runs smoothly without downtime.