Operations 8 min read

Understanding Load Balancing: Principles, Types, and Application Scenarios

This article explains the fundamentals of load balancing, covering its principles, classifications from layer 2 to layer 7, common software implementations, and typical application scenarios such as high traffic handling, horizontal scaling, fault tolerance, and multi‑zone disaster recovery.

Mike Chen's Internet Architecture
Mike Chen's Internet Architecture
Mike Chen's Internet Architecture
Understanding Load Balancing: Principles, Types, and Application Scenarios

Load Balancing

When a system faces a large number of user requests and high load, horizontal scaling by adding more servers and using clusters with load balancing is a common solution to increase processing capacity.

Moving from a single‑machine website to a distributed one involves business decomposition and deployment across multiple machines, creating a large‑scale distributed system.

Even after distribution, each independent service still faces single‑point failures and the need for a unified entry point; redundancy by deploying the same application on multiple machines addresses these issues.

Placing a load‑balancing device in front of a cluster provides traffic distribution and a single entry point.

Principles of Load Balancing

System expansion can be vertical (adding CPU, memory, storage) or horizontal (adding more machines). Vertical scaling cannot meet the demands of large‑scale, high‑concurrency, massive‑data scenarios, so horizontal scaling with clusters and load balancing is required.

Horizontal scaling adds machines to share the load, forming a typical cluster and load‑balancing architecture.

Application cluster: the same application deployed on multiple machines to handle requests distributed by the load balancer.

Load‑balancing device: distributes incoming requests to backend servers based on load‑balancing algorithms.

Functions of Load Balancing

1. Alleviates concurrency pressure and improves application throughput.

2. Provides fault‑tolerance and high availability.

3. Enables scalability by adding or removing servers.

4. Enhances security through filtering, black‑/white‑listing, etc., on the load‑balancing device.

Classification of Load Balancing

1) Layer‑2 load balancing (MAC): uses virtual MAC addresses to forward traffic.

2) Layer‑3 load balancing (IP): uses virtual IP addresses to forward traffic.

3) Layer‑4 load balancing (TCP): forwards based on IP + port.

4) Layer‑7 load balancing (HTTP): forwards based on virtual URLs or hostnames, inspecting application‑layer data.

Common Layer‑4 and Layer‑7 Load Balancers

Layer‑4 (L4) switches operate at IP and TCP/UDP layers and do not interpret application protocols. Typical software includes:

F5 (hardware, high cost)

LVS (heavy‑weight L4 software)

NGINX (lightweight L4 with caching and flexible regex)

HAProxy (flexible L4 forwarding)

Layer‑7 (L7) switches also analyze application‑layer information such as HTTP URIs or cookies. Typical software includes:

HAProxy (full L7 proxy, session persistence, routing)

NGINX (strong HTTP/mail support, performance comparable to HAProxy)

Apache (limited functionality)

MySQL Proxy (adequate for database traffic)

In practice, LVS is often used for L4, NGINX for L7, and HAProxy for flexible solutions covering both layers.

Application Scenarios

Scenario 1: High‑traffic services – distribute load across multiple servers.

Scenario 2: Horizontal system expansion – add or remove servers as business grows.

Scenario 3: Eliminate single‑point failures – automatically bypass failed servers.

Scenario 4: Cross‑zone disaster recovery – switch traffic to a backup availability zone when the primary zone fails, and revert when it recovers.

Overall, load balancing is essential for building reliable, scalable, and high‑performance distributed systems.

Distributed SystemsHigh AvailabilityLoad BalancingScalingnetwork operations
Mike Chen's Internet Architecture
Written by

Mike Chen's Internet Architecture

Over ten years of BAT architecture experience, shared generously!

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.