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

What’s Being Compared

Load balancers and reverse proxies are both network intermediaries that sit between clients and servers, but they serve different primary purposes. Load balancers distribute traffic across multiple servers; reverse proxies provide a unified interface to backend services. Understanding when to use which — or both — is essential for system architecture.

The Core Tension

The fundamental distinction is whether you have multiple servers doing the same thing (load balancer territory) or whether you need to abstract, protect, and augment a backend (reverse proxy territory). In practice, tools like Nginx and HAProxy blur this line by supporting both roles.

Comparison

DimensionLayer 4 Load Balancing / Layer 7 Load BalancingReverse Proxy
Primary purposeDistribute load across multiple serversCentralize and protect backend services
When neededMultiple servers serving same functionEven a single server benefits
Traffic distributionYes — random, round-robin, least-loadedNot primary focus
SSL terminationSupportedSupported
CachingNot primary focusSupported
CompressionNot primary focusSupported
Static content servingNoYes
Single point of failureYes — requires multiple LBsYes — requires multiple RPs
ExamplesHAProxy (LB mode), AWS ELBNginx, HAProxy (reverse proxy mode)

When to Choose Load Balancer

  • You have multiple application servers that need traffic distributed among them
  • You need health checks to route away from failing servers
  • You need session persistence (sticky sessions)
  • You need to support horizontal scaling of stateless services

When to Choose Reverse Proxy

  • You have only one application server but want SSL termination, caching, or compression
  • You want to hide backend server details from clients
  • You need to serve static content directly without hitting the app server
  • You want to compress responses before sending to clients

The Insight

Nginx and HAProxy can act as both, and in production they often do. A typical setup: reverse proxy (Nginx) terminates SSL, serves static files, and reverse-proxies API calls to a set of application servers behind a load balancer (HAProxy) that distributes requests. The lines blur because a Layer 7 load balancer IS a reverse proxy by function — it terminates connections, inspects content, and forwards to backends.

Connections