Skip to the content.

🔁 Load Balancer

📌 Purpose:

Ensures performance, availability, fault tolerance, and scalability by distributing traffic across servers.

🛠 Examples:

⭐ Key Features:


🧱 Types:

  1. Layer 4 Load Balancer (Transport Layer)

    • Uses IP addresses, TCP/UDP ports
    • Fast, low-level routing
  2. Layer 7 Load Balancer (Application Layer)

    • Advanced routing using:

      • HTTP Methods
      • URLs, Query Strings
      • Headers, Cookies
      • Application logic (e.g., /api, /images)

🔄 Reverse Proxy

📌 Features:

✅ Use Case:

Sits in front of backend servers and forwards requests.


🧠 Difference Between Reverse Proxy & Load Balancer:

✅ A load balancer is a specialized type of reverse proxy


🌐 Nginx

📌 Type:

Multi-purpose web server and reverse proxy

🔧 Can Do:


⚡ HAProxy

📌 Type:

Specialized load balancer for high-performance use

🔧 Can Do:


🆚 Nginx vs HAProxy

Use Case Best Tool
Static file serving ✅ Nginx
Web server with reverse proxy ✅ Nginx
Simple app hosting + load balancing ✅ Nginx
High-speed traffic distribution ✅ HAProxy
Advanced TCP load balancing (L4) ✅ HAProxy
Tool Analogy
Nginx Swiss Army knife – does many things (web server, proxy, SSL, load balancer)
HAProxy Formula 1 car – does one thing (load balancing) extremely well

➡️ Typical Setup: Internet → Nginx (reverse proxy, SSL) → HAProxy (load balancer) → App Servers


🚪 API Gateway

📌 Purpose:

Central entry point in microservices architectures.

🛠 Examples:

⭐ Features:


🧭 When to Use What?

Goal Use
High availability & traffic distribution ✅ Load Balancer
Security, caching, flexible routing ✅ Reverse Proxy
Managing APIs/microservices ✅ API Gateway