Load balancing can be performed at various layers in the Open Systems Interconnection (OSI) Reference Model.
L4 Load Balancer -
- Operate at OSI Model Layer 4 (Transport Layer)
- Traffic forwarded on basis of source and destination IP addresses and ports [part of header data in a packet]
- Does not matter what is content of the messages
- Transmission Control Protocol (TCP) operates at the transport layer (Layer 4).
- The source and destination IP of each packet is changed by the load balancer using NAT (Network address translation).
- No TLS termination
L7 Load Balancer -
- Application Load Balancers based on Layer 7 of OSI
- Operates at Layer 7 so can view actual content of each message
- Can route data based on URL, context root, cookie, Session etc
- Terminates the network traffic and reads the message within
- More CPU‑intensive then L4 LBs
- Most of the time called reverse proxy