We all are familiar with the load balancing concept.
The idea is simple, just split it down the total traffic to a machine to multiple machines.
Depending upon the protocol type which we used in the load balancing technique, we can mainly spit the load balancing types to two.
1. Network layer load balancing. (Layer 4 in the OSI)
2. Application layer load balancing. (Layer 7 in the OSI)
OSI (Open System Interconnection) model layers are listed below:
Layer 7--Application layer. Layer 6--Presentation layer. Layer 5--Session layer. Layer 4--Transport layer. Layer 3--Network layer. Layer 2--Data Link layer. Layer 1--Physical layer.
We need the layer 4 & 7 in detail.
OSI Model, Layer 4, provides transparent transfer of data between end systems, or hosts, and is responsible for end-to-end error recovery and flow control. It ensures complete data transfer.
Layer 4 Transport examples include SPX, TCP, UDP.
OSI Model, Layer 7, supports application and end-user processes. Everything at this layer is application-specific. This layer provides application services for file transfers, e-mail, and other network software services.
Telnet and FTP are applications that exist entirely in the application level.
Layer 7 Application examples include WWW browsers, NFS, SNMP, Telnet, HTTP, HTTPS, FTP
Back to Load Balancing…
We can define load balancing at different layers. The classic type load balancing works at layer 4. and the Application layer load balancing works at layer 7.
The types of Load Balancing offered by AWS (Amazon Web Services) are;
1. Classic load balancing. (Layer 4 or Layer 7 Load Balancing)
2. Application layer load balancing. (Layer 7 in the OSI).
3. Network Load Balancer. (Layer 4 in the OSI)
Here we are going to discuss the advantages on layer 7 load balancing over layer 4 load balancing. Which means the advantages of Application layer load balancing over network layer.
1. It operates at the highest level of OSI model.
2. Can use the protocol HTTP/HTTPS to define rules.
3. Layer 7 load balancers route network traffic in a much more sophisticated way than Layer 4 load
balancers, particularly applicable to TCP-based traffic such as HTTP.
4. Application layer load balancer analyses the actual content of each messages.
Which means it analyses the incoming header and take decisions based on content of header.
5. Layer 4 load balancing doesn’t analyse the header information. It just reroute the incoming
6. We can define different rules and targets.
7. Layer 7 load balancing enables the load balancer to make smarter load-balancing decisions, and to apply optimisations and changes to the content (such as compression and encryption).
8. It uses buffering to offload slow connections from the upstream servers, which improves performance.
1. The CPU usage is comparatively high.
A layer 7 load balancing is often referred as Reverse Proxy. And we are familiar with widely using layer 7 load balancer “Nginx.”