Kubernetes 로드 밸런싱 전략 비교 (L4, L7, Ring Hash, Maglev)
Source
Evernote/Inbox/Load balancing strategies in Kubernetes L4 round robin, L7 round robin, ring hash, and more.md
Summary
이 문서는 Kubernetes 환경에서의 다양한 로드 밸런싱 전략과 그 트레이드오프를 설명합니다. 기본인 kube-proxy(L4 Round Robin)는 설정이 간단하지만 서비스 수가 증가할수록 지연 시간이 발생하며, gRPC/HTTP/2 같은 프로토콜의 특성을 반영하지 못합니다. 이를 보완하기 위해 Envoy 기반 API Gateway(Ambassador)를 사용한 L7 Round Robin은 개별 요청 단위로 더 공정한 분배가 가능합니다. 또한, 클라이언트 상태 유지나 캐시 효율성을 위해 동일한 클라이언트를 특정 Pod 로 고정하는 Ring Hash(일관된 해싱)와, 이를 개선하여 메모리 사용량과 조회 속도를 최적화한 Maglev 알고리즘의 특징과 한계(노드 장애 시 테이블 재생성 비용 등)를 비교합니다.
Key Points
- kube-proxy(L4 Round Robin): Kubernetes 기본 전략으로 설정이 단순하지만, iptables 규칙 복잡성으로 인한 지연 시간 증가 및 L7 프로토콜(gRPC 등)의 세션 특성 반영 불가.
- L7 Round Robin: Envoy 기반 API Gateway 사용 시 kube-proxy 우회 가능. Kubernetes Endpoints API 를 통해 Pod 가용성 추적 및 개별 요청 단위의 공정한 분배 지원.
- Ring Hash: 클라이언트 ID/IP 기반 해싱으로 동일 클라이언트 요청을 특정 Pod 로 고정. 세션 상태 유지 및 캐시 히트율 향상에 유리하나, 부하 분산 불균형 및 해싱 연산 오버헤드 존재.
- Maglev: Google 개발의 일관된 해싱 알고리즘. Ring Hash 대비 CPU 캐시 효율성 및 메모리 사용량 최적화. 그러나 Kubernetes 의 짧은 Pod 수명 주기 특성상 노드 장애 시 테이블 재생성 비용이 높을 수 있음.
Related
-
Scheduling in a Random Environment: Stability and Asymptotic Optimality
-
지연 기반 네트워크 유틸리티 최대화 (Delay-Based Network Utility Maximization)
-
Online Graph Edge-Coloring in the Random-Order Arrival Model
-
Algebraic Optimization for Processing Graph Pattern Queries in the Cloud
-
Network-Wide Local Unambiguous Failure Localization (NWL-UFL) via Monitoring Trails
-
Truthful Mobile Crowdsensing for Strategic Users With Private Data Quality
-
Quantifying and Verifying Reachability for Access Controlled Networks
-
Multi-Armed Recommendation Bandits for Selecting State Machine Policies for Robotic Systems
-
A Prediction-Based User Selection Framework for Heterogeneous Mobile CrowdSensing
-
Beyond 1Mbps Global Overlay Live Streaming: The Case of Proxy Helpers
-
Eureka: Edge-Based Discovery of Training Data for Machine Learning
-
Two-Hop Wireless Communication Systems의 Effective Capacity 분석
-
Adaptive Speculative Processing of Out-of-Order Event Streams
-
P2P VoD 환경에서의 복제 알고리즘 분석 (On Replication Algorithm in P2P VoD)