Buildfest Learn System DesignRead and experiment freely · Sign in to save your work
Practice library Foundations Load balancing

LESSON 01 • FOUNDATION

One server has limits.
Your system doesn’t have to.

Learn how load balancers share the work, what happens when a server fails, and where scaling stops helping.

01LOAD
BALANCING
THE BIG IDEA

Distribute the work. Understand the limits.
Adding servers only helps when you know your bottleneck.

Prerequisites: HTTP requests and basic arithmetic. Audience: learners ready for these prerequisites. Objectives: explain the mechanism, calculate a bounded example, reproduce a failure and defend an alternative.

Problem

A college opens exam results. One server can handle an assumed 200 requests/s, but 500 arrive each second. Without an admission policy, work accumulates and clients time out.

Intuition

Imagine several checkout counters and a person directing customers. A load balancer routes requests to application instances. Unlike people at counters, requests may carry shared authentication state, retry automatically or last for very different durations. Equal request counts do not imply equal CPU work.

Concept

Round robin cycles through eligible upstreams. Least connections favors upstreams with fewer active connections; it is not a direct CPU measurement. Health checks help exclude failures, but detection takes time. Externalize shared session state or consciously choose affinity. Affinity can create imbalance and is not a substitute for durable state.

Architecture

Clients→Load balancer→App A / App B→Database

Worked example

With three healthy servers at 200 requests/s, capacity is 600 requests/s. At 500 offered requests/s, modeled fleet utilization is 500/600 = 83.3%. Lose one server: capacity becomes 400; the simplified model rejects 100 requests/s. Real queues and latency are excluded.

Experiment

Start with three servers, 500 requests/s and capacity 200. Predict the result before changing a value. Fail one server, record served and rejected requests, then add a server. Explain why adding app servers may not help a saturated database.

Failure

A healthy HTTP endpoint may conceal a broken database dependency. One balancer can itself be a failure point. A retry of a payment request can duplicate a side effect unless the application implements idempotency. Use bounded retries, deadlines and readiness checks.

Trade-off, security, performance and cost

More instances add cost and operational complexity. TLS termination centralizes certificate handling but requires secured upstream traffic and trusted forwarding headers. Track request rate, errors, saturation and latency distributions; do not infer user experience from average CPU alone.

Assignment

Guided: reproduce the worked scenario, change one assumption and record predicted and observed model behavior. Submit the diagram, calculation with units, failure timeline and a short decision record. Independent: choose a workload where this mechanism is the wrong first investment. Defend a simpler design using a concrete constraint.

Review

Knowledge checks: Which assumption is weakest? What fails first? What evidence would make you change your design? Expected outcome: a reproducible calculation and an explanation connecting mechanism to constraints. Rubric: mechanism accuracy 30%, explicit assumptions 20%, failure reasoning 20%, security and cost 15%, justified alternative 15%. A different architecture earns full credit if it satisfies the constraints. Misconception check: adding a mechanism does not automatically improve reliability. Instructor note: ask for the learner's prediction before revealing a model explanation; compare reasoning across revisions rather than time spent.

Further reading

NGINX: HTTP load balancing ↗ · Primary reference, reviewed October 20, 2026.