Balanceo de carga de capa 4 y capa 7
Elige entre un balanceador que reenvía conexiones TCP con rapidez y uno que lee cada petición HTTP para poder enrutar según el contenido.
A layer 4 balancer forwards connections without looking inside, and a layer 7 balancer reads the request and decides with what it finds.
Use it when#
L7: you want to retry a failed call on another server, or check a target's health over HTTP.
L4: raw throughput and low latency matter more than routing, or the traffic is not HTTP.
Either: a single balancer is the busiest node on the board.
How it works#
The two layers balance different things:
L4 works on IP addresses and ports. It picks a backend and passes the bytes along, so it does little work per request and handles very large volumes. AWS's Network Load Balancer is one.
L7 terminates the connection, parses HTTP, and can send
/apito one pool and/imagesto another, add headers, and retry. AWS's Application Load Balancer is one.
Splitting pools by kind also isolates them: a flood of page views cannot starve the API servers. Quorum gives that split to the API Gateway and leaves the balancer to spread what reaches it.
What it costs#
L7 does more work per request, so it has a lower ceiling, costs more per request, and adds latency. L4 cannot see paths or retry a request, and it spreads load by connection, so one long-lived connection can pin a server.
In Quorum#
A Load Balancer has a variant. L7 is the default, and L4 needs L4 load balancing. L4 forwards every kind of request on every Link. Neither variant routes by kind: putting page on one server group and read on another is the API Gateway's job.
Drag to pan. Hold Ctrl or Cmd and scroll to zoom.
| Where | Setting | Value | Why |
|---|---|---|---|
| Load Balancer | Variant | l7 | An L7 balancer reads each HTTP request, so it can retry a failed call on another server and check a target’s health. |
| App Server | Instance size | small | Small gives the app two vCPUs, enough to run code while the data tier does its own work. |
| App Server | Instance size | small | Small gives the app two vCPUs, enough to run code while the data tier does its own work. |
| Database | Instance size | small | Small gives the Database two vCPUs, so the figures below reflect the Cache and not a starved Database. |
Research this Design needs: Load balancing.
Drag to pan. Hold Ctrl or Cmd and scroll to zoom.
| Where | Setting | Value | Why |
|---|---|---|---|
| Load Balancer | Variant | l4 | An L4 balancer forwards TCP without reading HTTP, so it handles far more traffic for less money. It cannot retry. |
| App Server | Instance size | small | Small gives the app two vCPUs, enough to run code while the data tier does its own work. |
| App Server | Instance size | small | Small gives the app two vCPUs, enough to run code while the data tier does its own work. |
| Database | Instance size | small | Small gives the Database two vCPUs, so the figures below reflect the Cache and not a starved Database. |
Research this Design needs: Load balancing, Load balancing algorithms, L4 load balancing.
The glossary defines load balancer. Pair this with Load balancing algorithms.