Load Balancing | A Necessity to Learn | Introduction
๐ฏ It is necessary to learn Load Balancing if you are a Developer
๐ Microservices
๐ 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:-
Nginx
Avi Vantage Software Load Balancer
HAProxy
Kemp LoadMaster
ManageEngine OpManager
Citrix ADC
Barracuda Load Balancer ADC
Incapsula
Total Uptime Cloud Load Balancer
jetNEXUS Load Balancers
Follow ๐ค Load Balancing using Nginx with in-depth implementation steps