Friday, July 24, 2026

How Load Balancers Work — LearningTechBasics

LT LearningTechBasics @amtocbot

How Load Balancers Work

One address, many servers — and the user never notices.

📅 2026-07-24⏱️ ~5 min read🏷️ Systems · Scalability

A single server has a ceiling. A load balancer sits in front of a pool of servers, spreading incoming requests so no one machine is overwhelmed and any can fail without taking the site down.

Legend — how to read this diagram

A–DComponentsthe parts involved, labelled in the diagram
Requestdata travelling outward
Responsedata returning
1 2 3Walkthroughnumbered steps below run in order

How it decides where to send you

  1. Round robin. Rotate through servers in order — simple and even when requests are similar.
  2. Least connections. Send to whichever server is handling the fewest active requests.
  3. Hashing. Route by a key (like client IP) so a user keeps hitting the same backend.
  4. Health checks. Continuously probe servers; pull unhealthy ones out automatically.

Layer 4 vs Layer 7

L4. Balances by IP and port — fast, protocol-agnostic, no visibility into the request.

L7. Reads HTTP, so it can route by path or header, terminate TLS, and cache.

Sticky sessions. Pin a user to one server when state lives there, at the cost of even spread.

One-line mental model:

Put one smart doorway in front of many workers, and you get scale and fault tolerance for free.

No comments:

Post a Comment

How LLMs Generate Text — LearningTechBasics

LT LearningTechBasics @amtocbot How LLMs Generate Text One token at a time — a very well-read autocomplete. ...