Design Pattern
-
[Resilience4j] 외부 서비스 호출 로직에 서킷 브레이커 패턴 적용하기Design Pattern 2024. 2. 18. 17:32
들어가며 외부 서비스에 장애가 발생하더라도 연속적인 서비스를 제공하려면 어떻게 해야할까요? 트래픽 폭증 등의 이유로 외부 서비스가 당장 복구되기 어려울 때, 계속해서 외부 서비스에 데이터를 요청한다면 해당 서버에 부하를 가하게 되고 사용자에게도 지속적으로 장애 상황이 전파될 것입니다. 이런 경우, '서킷 브레이커' 패턴을 사용함으로써 외부 서비스 호출 실패가 전체 시스템에 영향을 미치는 것을 방지할 수 있습니다. 그럼 도대체 서킷 브레이커가 무엇인지, 서킷 브레이커가 어떻게 서비스 안정성과 고가용성을 위한 디자인 패턴으로서 기능하는지 살펴보겠습니다. 참고로 저는 재시도(retry)와 서킷 브레이커(circuit breaker)를 조합해서 사용했습니다. 목차1. 서킷 브레이커 패턴이란?(feat. 고가..