0Pricing
API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) · Lesson

Weighted Load Balancing & Backup Servers

Distribute traffic unevenly across servers using weights, and add backup servers that only take over when the primary pool fails.

When Servers Are Not Equal

Real upstream pools often mix machines of different capacity. A new 16-core server should not get the same share as an old 4-core box.

Nginx lets you bias traffic with weights so stronger servers handle more requests.

The weight Parameter

Add weight=N to a server. The default weight is 1. A server with weight=3 receives roughly three times as many requests as a weight=1 server.

upstream app {
    server 10.0.0.1 weight=3;
    server 10.0.0.2 weight=1;
}

All lessons in this course

  1. Load Balancing Algorithms
  2. Health Checks & Server Monitoring
  3. Sticky Sessions & Session Persistence
  4. Weighted Load Balancing & Backup Servers
← Back to API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway)