Load Balancing | A Necessity to Learn | Introduction
🎯 It is necessary to learn Load Balancing if you are a Developer
2 min read
👉 When writing the backend code, A developer should always think about how to design and structure the code. Forex. Before writing the server code involving multiple services like ordering food, giving feedback, and creating a user account. All these services mentioned before are independent (kind of) from each other. So, why keep them all in a single codebase?
🙂 We can separate the logic of creating, replacing, deleting, and updating the user from ordering a food item. So, we can make different services and can scale them independently. There are some tools like Docker, Kubernetes, etc to containerize and manage the containers respectively. But sometimes these servers get a lot of concurrent requests and might not serve all the clients in a small time. That is where we do replicate our servers (having different services) and distribute the traffic in different servers.
📍 Load Balancing Introduction
Well, when we request the server then we are not the only ones making a request. There are thousands or millions (Possibly) of concurrent users who can request the server at the same time. So, we must balance the incoming load or distribute the load.
👉 A load balancer does these things in general:-
Distributes the client's requests or network load to the different servers
Ensures high availability and reliability
Keeps the servers that are online and provides flexibility
🙂 There are some Algorithms to balance the load like Round Robin, Least connections, Hashing, and Random Selection.
🔥 Note:- Follow RealCS for more.
There are different types of load balancing though like DNS, Cloud, Global server, Hybrid, Layer 4, and Layer 7 load balancing. Two main load balancers are Layer 4 and 7 (Layers concerning the OSI model).
Load balancing can be done using:-
Balancing using DNS (Fails when a server gets down)
Balancing through Hardware (Most expensive way)
Balancing through Software (Reliable method)
Hardware load balancers are layers of 4-7 routers that are capable of handling all kinds of HTTP, HTTPS, TCP, and UDP traffic. Some of the popular software load balancers are:-
Avi Vantage Software Load Balancer
Barracuda Load Balancer ADC
Total Uptime Cloud Load Balancer
jetNEXUS Load Balancers
Follow 🤜 Load Balancing using Nginx with in-depth implementation steps