System Design Basics for Backend Developers · 강의

부하 분산 전략

로드 밸런서가 여러 서버에 트래픽을 분산해 수평 확장을 가능하게 하는 방법을 학습하고, 일반적인 라우팅 알고리즘과 상태 확인을 살펴보세요.

레슨 4/413개 단계

부하 분산 전략은(는) CoddyKit의 무료 System Design Basics for Backend Developers 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 System Design Basics for Backend Developers 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. System Design Basics for Backend Developers 강의에는 총 4개의 강의가 포함되어 있습니다.

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

Why Load Balancing?

Once you scale horizontally, you have many identical servers. But how do clients know which one to hit? A load balancer sits in front of your servers and spreads incoming requests across them.

  • Prevents any single server from being overwhelmed
  • Enables seamless scaling up and down
  • Improves availability if one server fails

Where the Balancer Sits

A load balancer is a reverse proxy: clients connect to one address, and the balancer forwards the request to a healthy backend. The client never sees the internal topology.

This indirection is what makes adding or removing servers invisible to users.

Client --> [Load Balancer] --> Server A
                            --> Server B
                            --> Server C

Round Robin

Round robin is the simplest algorithm: requests are handed to servers in rotation. Server A, then B, then C, then back to A.

It works well when all servers are equally powerful and requests cost roughly the same.

requests = ['r1','r2','r3','r4']
servers = ['A','B','C']
for i, r in enumerate(requests):
    print(r, '->', servers[i % len(servers)])

Least Connections

Least connections routes each new request to the server with the fewest active connections. This is smarter when request durations vary widely.

A server stuck on slow requests will not keep receiving new ones.

Weighted Algorithms

If servers have different capacity, assign weights. A server with weight 3 receives roughly three times as many requests as a server with weight 1.

  • Weighted round robin
  • Weighted least connections

IP Hash & Sticky Sessions

IP hash routes a given client consistently to the same server based on a hash of its IP. This creates sticky sessions, useful when a server holds in-memory session state.

Note: stickiness undermines stateless design. Prefer external session stores when possible.

def pick(ip, n):
    return hash(ip) % n
print('192.168.0.5 ->', pick('192.168.0.5', 3))

Health Checks

A load balancer periodically pings each backend with a health check (e.g. GET /health). Unhealthy servers are removed from rotation automatically.

This is how the system survives a server crash without manual intervention.

Layer 4 vs Layer 7

Layer 4 balancing operates on TCP/UDP, routing by IP and port — fast but blind to content. Layer 7 operates on HTTP, so it can route by URL path, headers, or cookies.

  • L4: high throughput, simple
  • L7: content-aware, supports path-based routing

DNS Load Balancing

At the largest scale, a single load balancer becomes a bottleneck. DNS-based balancing returns different server IPs to different clients, spreading load before traffic even reaches a balancer.

Often combined with regional balancers for global apps.

Avoiding the Single Point of Failure

The load balancer itself must not be a single point of failure. Run it in an active-passive or active-active pair, with a floating virtual IP that fails over if the primary dies.

Putting It Together

A typical scalable setup: DNS spreads clients across regions, regional L7 balancers do health-checked path routing, and least-connections distributes to a fleet of stateless app servers behind them.

Each layer removes a bottleneck and adds resilience.

Quick Check

Test your understanding of load balancing algorithms.

Recap

You learned how load balancing makes horizontal scaling practical:

  • Round robin, least connections, weighted, and IP hash algorithms
  • Health checks remove failed servers automatically
  • Layer 4 vs Layer 7, plus DNS balancing at scale
  • The balancer must itself be redundant
무료로 시작

AI 튜터와 함께 System Design Basics for Backend Developers을(를) 배우세요 — 무료

브라우저에서 실제 코드를 작성하고 실행하며, 24/7 AI 튜터로부터 즉각적인 도움을 받고, 웹이나 앱에서 중단한 부분부터 계속 학습하세요.

코스
12
레슨
48

자주 묻는 질문

“부하 분산 전략” 강의는 무료인가요?

네 — “부하 분산 전략” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 System Design Basics for Backend Developers 강의 전체를 잠금 해제할 수 있습니다. System Design Basics for Backend Developers 강의에는 총 4개의 강의가 포함되어 있습니다.

“부하 분산 전략”에서 뭘 배우나요?

로드 밸런서가 여러 서버에 트래픽을 분산해 수평 확장을 가능하게 하는 방법을 학습하고, 일반적인 라우팅 알고리즘과 상태 확인을 살펴보세요. 브라우저에서 직접 실행하는 실습 코드로 System Design Basics for Backend Developers을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

System Design Basics for Backend Developers을(를) 시작하는 데 경험이 필요한가요?

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

“부하 분산 전략” 강의는 얼마나 걸리나요?

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

이 System Design Basics for Backend Developers 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 System Design Basics for Backend Developers 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 수직 확장과 수평 확장 비교
  2. 상태 비저장 서비스와 상태 저장 서비스
  3. 분산 시스템 입문
  4. 부하 분산 전략
← System Design Basics for Backend Developers(으)로 돌아가기