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

가중치 기반 로드 밸런싱 및 백업 서버

가중치를 사용해 서버별로 트래픽을 균등하지 않게 분배하고, 주 서버 풀이 장애를 일으킬 때만 인계받는 백업 서버를 추가합니다.

가중치 기반 로드 밸런싱 및 백업 서버은(는) CoddyKit의 무료 API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

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;
}

How the Ratio Works

With weights 3 and 1, out of every 4 requests, 3 go to the first server and 1 to the second. Weights are relative, so 6 and 2 produce the same split as 3 and 1.

Weights with Other Algorithms

Weights work with round robin (the default) and least connections. They do not apply to ip_hash, which selects a server purely from the client IP.

upstream app {
    least_conn;
    server 10.0.0.1 weight=5;
    server 10.0.0.2 weight=2;
}

Introducing Backup Servers

A server marked backup receives no traffic while any primary server is available. It activates only when all primaries are down or unreachable.

upstream app {
    server 10.0.0.1;
    server 10.0.0.2;
    server 10.0.0.9 backup;
}

Why Use a Backup

Backups give you a graceful fallback, for example a maintenance page server or a secondary data center, without sending it normal traffic during healthy operation.

Marking a Server Down

Use down to permanently remove a server from rotation, handy during planned maintenance without deleting the line.

upstream app {
    server 10.0.0.1;
    server 10.0.0.2 down;
}

Failure Detection Parameters

max_fails sets how many failed attempts mark a server unavailable, and fail_timeout sets the window and how long it stays out.

server 10.0.0.1 max_fails=3 fail_timeout=30s;

Combining Weight and Backup

You can mix weights for primaries and keep a single backup for the whole pool. The backup ignores weight until it is the only option.

upstream app {
    server 10.0.0.1 weight=4;
    server 10.0.0.2 weight=1;
    server 10.0.0.9 backup;
}

Limiting Connections

The max_conns parameter caps simultaneous connections to a server, protecting a weaker box even if its weight is high.

server 10.0.0.2 weight=2 max_conns=100;

Testing the Distribution

Fire many requests and check your access logs per upstream to confirm the ratio matches the weights. Adjust weights based on observed CPU and latency.

for i in $(seq 1 100); do curl -s http://localhost/ > /dev/null; done

Quick Check

A server is marked backup. When does it receive requests?

Recap

You learned to fine-tune traffic distribution:

  • weight=N biases traffic toward stronger servers
  • Weights are relative and apply to round robin and least_conn
  • backup servers activate only when primaries fail
  • down, max_fails, and max_conns control availability

Together these give you precise control over an uneven server fleet.

자주 묻는 질문

“가중치 기반 로드 밸런싱 및 백업 서버” 강의는 무료인가요?

네 — “가중치 기반 로드 밸런싱 및 백업 서버” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) 강의 전체를 잠금 해제할 수 있습니다. API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) 강의에는 총 4개의 강의가 포함되어 있습니다.

“가중치 기반 로드 밸런싱 및 백업 서버”에서 뭘 배우나요?

가중치를 사용해 서버별로 트래픽을 균등하지 않게 분배하고, 주 서버 풀이 장애를 일으킬 때만 인계받는 백업 서버를 추가합니다. 브라우저에서 직접 실행하는 실습 코드로 API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway)을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway)을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway)은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.

“가중치 기반 로드 밸런싱 및 백업 서버” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway) 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 부하 분산 알고리즘
  2. 상태 확인 및 서버 모니터링
  3. 고정 세션 및 세션 지속성
  4. 가중치 기반 로드 밸런싱 및 백업 서버
← API Gateway & Reverse Proxy (Nginx + Spring Cloud Gateway)(으)로 돌아가기