L3/L4 Load balancer
- L3 load balancer uses IP addresses to distribute among servers.
- receive incoming traffic → evaluate the destination IP address → forward the traffic to the appropriate server.
- L4: operate and transport layer, which means TCP/UDP ports is distribute traffic among servers.
- The load balancer receives incoming traffic, evaluates the destination port number, and then forwards the traffic to the appropriate server.
- algorithms: round-robin, least connections, IP hash,…
- monitor health of servers by periodically send health check requests to each server. If a server fails to respond or responds with an error, the load balancer removes it from the pool of available servers until it becomes healthy again.
- session persistence: can maintain sessions.
- SSL termination: L3/L4 load balancers can also perform SSL termination, which means they can decrypt SSL traffic from clients, distribute it to the appropriate server, and then re-encrypt the traffic before sending it back to the client.
Different?
-
Complexity: L4 load balancers are generally less complex than L3 load balancers because they only need to evaluate port numbers rather than IP addresses.
-
Granularity: L3 load balancers offer more granular control over traffic routing than L4 load balancers because they can evaluate IP addresses and make more specific decisions about how to route traffic.
-
Performance: L4 load balancers are generally faster than L3 load balancers because they only need to evaluate port numbers, which requires less processing power than evaluating IP addresses.
-
SSL/TLS: L4 load balancers typically cannot terminate SSL/TLS (Secure Sockets Layer/Transport Layer Security) connections, while L3 load balancers can terminate SSL/TLS connections.
-
Traffic visibility: L3 load balancers can provide more visibility into network traffic than L4 load balancers because they operate at a higher layer of the OSI model and can therefore see more details about the traffic.
http://wtarreau.blogspot.com/2006/11/making-applications-scalable-with-load.html