inflearn logo
강의

Course

Instructor

Resilience4j - CircuitBreaker for creating fault-free services

Which exceptions should be designated as recordExceptions?

recordException을 지정하지 않았을때 동작 방식 질문

Resolved

145

soap

37 asked

0

Foo님 안녕하세요.

간단한 질문 드립니다!

recordException을 지정하지 않으면 서킷 브레이커 설정을 해도 동작을 안하는 걸까요? 아니면 기본적으로 RuntimeException과 Error만을 체크하는 걸까요?

 

감사합니다.

spring-boot msa circuit-breaker resilience4j

Answer 3

1

foo

soap님 오래 기다리셨습니다!

 

관련해서는 https://resilience4j.readme.io/docs/circuitbreaker#failure-rate-and-slow-call-rate-thresholds 에 아래와 같은 내용이 있습니다.

 

Failure rate and slow call rate thresholds

The state of the CircuitBreaker changes from CLOSED to OPEN when the failure rate is equal or greater than a configurable threshold. For example when more than 50% of the recorded calls have failed.
By default all exceptions count as a failure. You can define a list of exceptions which should count as a failure. All other exceptions are then counted as a success, unless they are ignored. Exceptions can also be ignored so that they neither count as a failure nor success.

The CircuitBreaker also changes from CLOSED to OPEN when the percentage of slow calls is equal or greater than a configurable threshold. For example when more than 50% of the recorded calls took longer than 5 seconds. This helps to reduce the load on an external system before it is actually unresponsive.

The failure rate and slow call rate can only be calculated, if a minimum number of calls were recorded. For example, if the minimum number of required calls is 10, then at least 10 calls must be recorded, before the failure rate can be calculated. If only 9 calls have been evaluated the CircuitBreaker will not trip open even if all 9 calls have failed.

 

즉, Resilience4j에서 구현한 서킷 브레이커는 기본적으로 모든 예외(RuntimeException, Error 포함)를 실패로 간주합니다. 여기서 특정 예외를 recordException로 지정했을 때는 해당 예외의 하위 예외들로 실패로 간주되는 예외의 폭이 줄어드는 겁니다.

 

혹시 추가적으로 궁금한 내용 있으면 질문 남겨주세요!

감사합니다.

1

foo

soap님 안녕하세요!

제가 현재 해외에 나와있어서 내일 복귀하는대로 답변 드리겠습니다.

감사합니다.

0

communityai8509

안녕하세요, 인프런 AI 인턴입니다. soap님.

Resilience4j에서 recordException 설정은 서킷 브레이커가 어떤 예외를 “실패”로 기록할지를 결정하는 중요한 설정입니다. recordException을 지정하지 않으면 기본적으로 모든 예외(Exception)가 실패로 간주됩니다. 즉, 별도로 설정하지 않아도 기본값으로 모든 예외가 서킷 브레이커의 실패 기준에 포함됩니다.

따라서 서킷 브레이커는 recordException을 설정하지 않더라도 기본적으로 RuntimeException과 Error를 포함한 모든 예외를 감지하게 됩니다. 그러나 특정 조건에 맞는 예외만을 실패로 기록하고자 한다면, recordException 설정을 명시해야 합니다.

서킷 브레이커 설정을 더 자세히 이해하는 데 도움이 될 링크를 아래에 첨부드립니다:

저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다. 현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏 추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.

패키지 구분에 대해 궁금한게 있습니다

0

7

1

스프링부트 서버 에러나요

0

17

1

2026.04에 추가된 강의 시청 불가

0

27

1

Service Create/Update Record 운용과 Delete Record 미운용의 차이 질문

0

18

1

인가 코드 발급(프론트 vs 백)

0

28

2

인텔리제이 MCP 서버 설정 관련

0

26

1

Sequence 관련 질문

1

32

2

Image Only Query

1

29

2

프롬프트, 스킬, sub-agent

0

31

1

도메인 모델에서 관계와 규칙을 구분하는 방법

0

37

2

현업에서 서킷브레이커 상태 전파를 할 때 Actuator를 사용 하시는지 궁금합니다!

1

109

1

Riot API Circuit Breaker 적용

1

278

2

Resilience4J 적절한 적용 예시인지 질문드립니다.

1

200

1

강의 자료 문의

1

317

2

scale out 환경에서 api 호출로 circuit 상태 변경하기

1

299

1

예외 선언 위치

0

273

1

Circuitbreaker 사용 주체

1

239

1

Retry 사용

1

255

1

slow call 관련 옵션을 무시할 수 있나요?

1

217

1

n 대의 서버간 서킷 브레이커의 상태를 동기화 시키려면 어떻게 해야 될까요?

1

517

1

안녕하세요 강사님 질문있습니다!

1

293

2

컨테이너 환경에서의 circuitbreaker 상태 전파 방식 질문

1

512

2

Circuit Breaker의 적용처 판단

1

440

2

IgnoreException 동작이 주석의 설명과 좀 다른것같습니다

1

368

1