서킷 브레이커
원격 서비스/리소스 장애가 임계치에 도달하면 일시적으로 접근을 차단해 반복 실패·재시도를 막는 패턴
구조와 동작 원리
화살표를 단계별로 확인하세요.
실패가 누적되면 호출을 차단하고 제한된 시험 호출로 회복을 확인한다.
기대 효과
장애 영향을 제한하고 실패한 서비스에 대한 재시도 자원 낭비 감소
트레이드오프
임계치가 낮으면 일시적 블립에도 회로가 열리는 오탐 가능성 증가
입력 검증처럼 높은 기준 오류율이 설계상 정상인 서비스에는 부적합
운영 및 적용 가이드
종합 설명 · 원문 인용으로 검증된 항목과 구분됩니다. 실제 적용 전 확인이 필요합니다.
언제 사용하는가
마이크로서비스 간 원격 호출이 반복 타임아웃·5xx로 실패할 때 호출을 차단하고, 일정 시간 후 반개방 상태로 복구를 시험하는 유스케이스다.
시나리오
이커머스 대규모 주문 서비스에서 주문 API가 재고·결제·알림 서비스를 동기 호출한다. 결제 서비스 지연이 급증하면 주문 API의 스레드·연결이 고갈되어 전체 주문이 실패할 수 있다. 결제 호출에 서킷 브레이커를 두어 오류율 임계치 초과 시 빠르게 폴백하고, 반개방 상태에서 제한된 요청으로 복구를 확인한다. 요구사항은 주문 성공률 보호, 장애 전파 차단, 운영 알림과 대시보드 가시성이다.
배치 원칙
- 게이트웨이·엣지에서 중앙 집중형으로 배치
- 서비스 메시/사이드카 프록시에 라우팅·관측·정책과 함께 배치
- 클라이언트 라이브러리로 호출부에 내장
- 다중 클러스터·리전은 공유 저장소 기반 분산 코디네이터로 상태 조율
온프레미스
서비스 메시/API 게이트웨이를 온프레미스 K8s·VM에 배포하고 의존성별 임계치·타임아웃·폴백을 환경 차이에 맞게 튜닝한다. 중앙 설정 배포 경로와 관측 스택을 먼저 표준화한다.
클라우드
관리형 K8s/서비스 메시·게이트웨이 정책으로 구성하고 배포·업그레이드 중 브레이커 상태와 폴백을 모니터링한다. 관리형 메트릭·알림과 오토스케일링을 연계한다.
Kubernetes
Istio DestinationRule의 OutlierDetection, 서비스 메시 Circuit Breaker 정책, Hystrix·Resilience4j·opossum 같은 라이브러리로 구현한다. ConfigMap/CRD로 임계치·리셋 타임아웃을 관리하고 Pod·노드 드레인/롤아웃 시 상태 전이를 관측한다.
장애 대응
대표 장애는 의존성 지연·오류 급증, 오탐 오픈, 반개방 복구 실패, 폴백 자체 장애, 무알림 오픈이다. 절차: 알림·메트릭으로 브레이커 상태와 의존성 SLO 확인 → 임계치·타임아웃·폴백 설정과 최근 배포 점검 → 필요 시 회로 수동 차단·우회·트래픽 분산 → 완화 후 반개방 복구와 재발 방지 튜닝 순으로 대응한다.
14개 관점별 근거
조사 당시 근거 보유 여부입니다. 출처의 정확성과 최신성을 별도로 판단하세요.
정의·개요근거 있음
원격 서비스/리소스 장애가 임계치에 도달하면 일시적으로 접근을 차단해 반복 실패·재시도를 막는 패턴
Temporarily block access to a remote service or resource after failures reach a threshold해결하는 문제근거 있음
분산 환경에서 원격 호출의 일시적 장애·과부하·지연·타임아웃이 연쇄 실패로 번지는 문제를 완화
In a distributed environment, calls to remote resources and services can fail because of transient faults.주요 구성 컴포넌트·리소스근거 있음
타임아웃, 오류 임계치(%), 리셋 타임아웃, 폴백 등 옵션으로 구성
const options = { timeout: 3000, errorThresholdPercentage: 50, resetTimeout: 30000, fallback: () => 'Service temporarily unavailable' };데이터·에셋 배치 원칙근거 있음
게이트웨이(엣지)에서 중앙 집중 제어해 보호
Gateway-level breaker: centralized control at edge, protects ...대표 유스케이스근거 있음
마이크로서비스 원격 호출에서 반복 타임아웃/실패 시 호출을 차단하고 복구를 감지
When multiple microservices collaborate to handle requests, one or more services might become unavailable or exhibit high latency.시나리오 예시근거 있음
관측 대시보드/커넥터 장애 시 파이프라인 로깅 호출을 차단하는 시나리오
Pipelines interact with dashboards, like Sumo Logic or ELK Stack to log key performance indicators (KPIs)부적합 상황·주의근거 있음
입력 검증처럼 높은 기준 오류율이 설계상 정상인 서비스에는 부적합
User input validation services may reject `30%` of requests. A circuit breaker would stay permanently open.온프레미스 관점(개발·배포·운영)근거 있음
온프레미스에서는 서비스 메시/게이트웨이 기반으로 컨테이너·VM 배포·운영
Deploy Kong Mesh anywhere: on Kubernetes, in the cloud, on-premises, with containers or on virtual machines.클라우드 관점(개발·배포·운영)근거 있음
클라우드 관리형 Kubernetes 업그레이드 중 브레이커 상태 모니터링·폴백
// Monitor circuit breaker state during upgradesKubernetes 관점(개발·배포·운영)근거 있음
Kubernetes에서 Istio DestinationRule의 OutlierDetection 등으로 서킷 브레이커 구성
For configuring a circuit breaker in Istio we are using `OutlierDetection` object.장애 대응 관점근거 있음
무알림 오픈·폴백 실패는 탐지를 지연시키므로 상태 전이 메트릭·알림·의존성 상태 확인 필요
Silent trips: The breaker stays “Open” and serves degraded responses for an extended period while emitting no state-transition metric or alert장점근거 있음
장애 영향을 제한하고 실패한 서비스에 대한 재시도 자원 낭비 감소
The benefit of this pattern is that it limits the consequences of a failure by wrapping the interface to that element단점·트레이드오프근거 있음
임계치가 낮으면 일시적 블립에도 회로가 열리는 오탐 가능성 증가
The lower the `error_threshold`, the higher the probability of a false-positive circuit open.대표 기술·도구근거 있음
Hystrix·Ribbon 등이 대표적
This example demonstrates how to use Hystrix circuit breaker and the Ribbon Load Balancing.추가 참고 문헌 (22)
- Circuit Breaker Pattern - Azure Architecture Center | Microsoft Learn ↗
- Circuit breaker pattern - AWS Prescriptive Guidance ↗
- What is Circuit breaker? Meaning, Architecture, Examples, Use Cases, and How to Measure It (2026 Guide) - SRE School ↗
- Circuit Breaker: How to Keep One Failure from Taking Down Everything ↗
- Implementing the Circuit Breaker pattern - .NET | Microsoft Learn ↗
- The Circuit Breaker Pattern - Dos and Don'ts — AKF Partners ↗
- docs/operations/failurehandling.md ↗
- Tactics and Patterns for Software Robustness | CMU Software Engineering Institute ↗
- Dynamic configuration management and circuit breakers in Kubernetes - rastko ↗
- Azure Kubernetes Service (AKS) production upgrade strategies - Azure Kubernetes Service | Microsoft Learn ↗
- ECS vs Kubernetes: Paying for Portability Up Front ↗
- Istio and mTLS — securing and observing your service mesh ↗
- Kong Mesh: Enterprise Service Mesh for Kubernetes | Kong Inc. ↗
- Kubernetes Circuit Breaker & Load Balancer Example ↗
- Circuit breaker and retries on Kubernetes with Istio and Spring Boot ↗
- Zero-Downtime Migration to Azure Kubernetes Service (AKS) - Azure Kubernetes Service | Microsoft Learn ↗
- Your Circuit Breaker is Misconfigured - Shopify ↗
- Circuit Breaker | arc42 Quality Model ↗
- Circuit Breaker Policy Fine-tuning Best Practice - .NET Blog ↗
- Circuit Breaker Trade Offs: When Not to Use Them ↗
- Learn Trade-Offs and Limitations of Circuit Breakers | Designing Resilient Architectures ↗
- Google SRE - Troubleshooting Methodology: A Learning Path ↗