Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Content-based Load Balancer

DZone's Guide to

Content-based Load Balancer

Here is a short guide to content-based load balancing, focusing on layers 4 and 7.

· Performance Zone
Free Resource

Load balancing can be performed at various layers in the Open Systems Interconnection (OSI) Reference Model for networking. Generally, load balancers run at Layer 4 (Transport) or at Layer 7 (Application).

So far different providers used to provide the load balancers only at Layer 4, but recently providers like AWS, Google Cloud, and NGINX, have come up with Layer 7, content-based load balancers also known as Application Load Balancer.

The Difference Between Layer 4 and Layer 7

Layer 4

It operates at transport layer with protocols like TCP/UDP and does not look inside of the actual network packets, remaining unaware of the specifics of HTTP and HTTPS. That means simply delivering the messages with no regard to content of the message, with a load balancing algorithm such as round-robin and by calculating the best destination server based on least connections or server response times.

Layer 7

It operates at a high-level of OSI model, i.e. application layer which deals with the content of the message. With a protocol such as HTTP, a load balancer can uniquely identify client sessions based on cookies and use this information to deliver all client's requests to the same server. 

New – AWS Application Load Balancer | AWS Blog

It is designed to handle streaming, real-time, and WebSocket workloads in an optimized fashion. Instead of buffering requests and responses, it handles them in streaming fashion. This reduces latency and increases the perceived performance of your application.

Benefits

  • URL based routing: Create a load balancer that routes to the different instances based on URL path.
  • Support for container-based applications: Container-based applications which are based on micro service architecture, the Content Based Load Balancer understands and supports its needs. It allows one instance to host several containers that listen on multiple ports behind the same target group and also performs fine-grained, port-level health checks.
  • Support for additional protocols: It supports two additional protocols like WebSocket and HTTP/2.
  • Cost Efficient: It is cheaper as compared to traditional load balancers. AWS charges 10% lower than 'Classic Load Balancers'.

Conclusion

Content Based Load Balancer is a way forward — a new alternative to traditional transport layer load balancers as it operates in a more efficient way.

Topics:
aws ,nginix ,cloud computing ,micro services ,containers ,load balancer ,application architecture ,application development ,devops

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}