Load balancing is a method of traffic management that will redirect the incoming traffic to your multiple servers. That way, non of them will get all the traffic, they will be able to manage less traffic better, and your network will be stronger. Now we will look 3 types of Load Balancing and how do they differ from one another.
Network load balancing
The network load balancing is ideal for balancing TCP and UDP traffic from clients over the internet. It operates on Layer 4 (the transport layer) of the OSI model (Open Systems Interconnection Model). When the network load balancer receives the traffic, it uses its algorithm and directs the traffic to one of the predefined servers in its list. It opens a TCP connection on the designated port and forwards the requests without modifying them. Not modifying them, but also not inspecting them, which means that the traffic is not checked about malicious packets, not it is organized based on the type of traffic it is. The focus here is just to transfer the traffic to various servers that are on the network.
You can use it when you are expecting large TCP or UDP traffic spikes, and you want to keep the packets unchanged.
It is easy to set up, scalable and it can save you during times of extreme traffic.
The Classic load balancing is very similar to network load balancing. It also can manage TCP and UDP, but also SSL, HTTP, and HTTPS traffic. The big difference here is that it works both on Layer 4 and Layer 7 of the OSI model. It has 3 components: the Classic load balancing instances, Listeners, and the Back-end servers.
The CLB instances will capture the traffic and distribute it to the Backed servers.
The Listeners will check the Back-end servers and see if they are functional. If any of them is down, they will give instruction to the CLB not to direct traffic to them until they are back in order.
The Classic load balancing is relatively economical, easy to set up, and provides good availability.
It also supports sticky sessions, so if a client connects to a particular Back-end server, it will stick to it and won’t go and connect to another for the time of the session.
Application load balancing
The Application load balancing works only on layer 7 (the application layer) of the OSI model. Here the load balancer is more intelligent and uses many parameters like hostname, host location (IP address), port number, and other parameters of the query. It supports protocols like HTTP, HTTPS, and WebSockets. It supports a sticky session that keeps the session open and doesn’t redirect to another instance. The Application load balancer checks the Back-end servers for different parameters and can take more advanced decisions regarding traffic distribution. It has the same components as the Classic one: load balancers, listeners, and back-end servers.
These are the 3 types of Load Balancing. You should pay attention to the protocols they use and at what level of the OSI model they work to properly understand them.