HAProxy Enterprise Documentation 12.5


In this section, you will learn how to load balance traffic at layer 4, the transport layer. Information available at layer 4 of the OSI model consists only of IP addresses and TCP/UDP ports. It ignores higher-level application metadata. This creates a more simplistic, and often faster, form of traffic routing.

While load balancing at layer 7, the application layer, is a good option when routing HTTP messages because it allows you to relay the messages to different servers depending on the application-level metadata such as the URL, headers, and the HTTP verb used, layer 4 load balancing is a good option when you simply need to route TCP/IP or UDP traffic without this application-layer knowledge.

Load balancing at this layer involves using the embedded HAProxy for TCP/IP or Linux Virtual Server (LVS) for UDP.


With Layer 4 load balancing, HAProxy ALOHA can manage 64 000 connections at most.

Layer 4 load balancing modes at a glance

When configuring layer 4 load balancing, you have several ways to set up routing, with each serving a different use case.

Direct Server Return

TCP Load Balancing

UDP Load Balancing

Use case

High volume traffic

TCP-based services

UDP-based services

Backend server OS


Linux or Windows

Linux or Windows

Responses flow through the ALOHA?




See also

Linux Virtual Server

Next up

Direct Server Return