• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

The Problem

Vertical scaling (buying a bigger server) hits diminishing returns — costs grow super-linearly while performance gains taper off, and high-end hardware requires specialized expertise.

Core Idea

Horizontal scaling adds more commodity machines to distribute load across them, improving both performance and availability through parallelism and redundancy.

How It Works

  1. Clone identical server instances behind a load balancer.
  2. Servers must be stateless — no user data stored locally on any instance.
  3. Session data is stored in a centralized, shared store (Redis, Memcached, database).
  4. The load balancer distributes incoming requests across all available instances.
  5. More instances are added during traffic spikes and removed during lulls (auto-scaling).
  6. Commodity hardware costs less than equivalent vertical upgrades and is easier to hire for.

Visual Explanation

horizontal_scaling CLIENTS Clients LB Load Balancer CLIENTS->LB S1 App Server 1 LB->S1 S2 App Server 2 LB->S2 S3 App Server N LB->S3 STORE Shared State Store (Redis / DB) S1->STORE read/write session S2->STORE S3->STORE

Key Properties

  • Scales out by adding more machines (contrast: scaling up = bigger machine)
  • Requires a load balancer to distribute traffic
  • Servers must be stateless — user sessions live in an external store
  • More cost-effective than vertical scaling at medium to large scale
  • Higher availability than a single server — failure of one instance doesn’t take down the system

Connections

Edge Cases & Gotchas

  • Statelessness is hard for legacy applications that assume local file system access or in-memory session state
  • Auto-scaling can cause thundering herds if new instances all hit the database simultaneously on startup
  • Horizontal scaling does not help with database writes — those require sharding or read replicas