Layer 4 Load Balancing
Hop's redirect servers are all identical: any one of them can answer any short code. The load balancer in front of them does not need to understand anything about the request — it only needs to hand each new connection to some healthy server, very fast. That is exactly what a layer 4 load balancer does.
The rule
Layer 4 sees addresses and ports, never the request inside.
The "layers" come from the networking model. Layer 4 is the transport layer: TCP and UDP. At this level, a connection is described by a handful of numbers:
source IP 198.51.100.7 source port 53122
dest IP 203.0.113.40 dest port 443 protocol TCPA layer 4 load balancer looks only at these, picks a back-end server, and forwards the whole connection there. It never reads the HTTP method, the URL path, headers or cookies — with HTTPS it could not read them anyway without decrypting.
What that gives you:
- Speed and scale — little work per packet, so it handles huge numbers of connections cheaply.
- Any protocol — works for HTTP, databases, game traffic, anything over TCP or UDP.
- Encryption untouched — HTTPS can pass straight through to the servers.
What it cannot do:
- route
/api/to one pool and/to another - choose by cookie, header or user
- rewrite requests, add headers or cache responses
The shortcut
Ask: "Does the decision need anything inside the request?" No → layer 4 is enough, and it is the faster, simpler choice.
A connection arrives
From 198.51.100.7, port 53122, to Hop's address on port 443.
A subtle trap: because layer 4 balances connections, one browser keeping a connection open for many requests sends them all to the same server. With long-lived connections, load can end up less even than the request count suggests.
Drills
Answer fast — trust the rule.
What information does a layer 4 load balancer use to choose a server?
Which task is impossible for a pure layer 4 load balancer?
Why is layer 4 balancing usually faster than layer 7?
Which traffic can a layer 4 balancer handle that an HTTP-only balancer cannot?
Remember
- Layer 4 sees addresses and ports, never the request inside.
- Shortcut: if the decision needs nothing inside the request, layer 4 is enough and faster.
- Trap: it balances connections, so long-lived connections can skew the load.
